ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I modify the decimal places viewed in complex numbers (https://www.excelbanter.com/excel-discussion-misc-queries/196999-how-do-i-modify-decimal-places-viewed-complex-numbers.html)

abbyjaz

How do I modify the decimal places viewed in complex numbers
 
=COMPLEX(COS(C9),SIN(C9)) returns 0.564642473395035+0.564642473395035i and we
want 0.56+0.56i

Infinitogool

How do I modify the decimal places viewed in complex numbers
 
Hi
See if the article at
http://support.microsoft.com/?scid=k...51338&x=11&y=6
does what you want.

Regards,
Pedro J.

=COMPLEX(COS(C9),SIN(C9)) returns 0.564642473395035+0.564642473395035i and we
want 0.56+0.56i


Dana DeLouis

How do I modify the decimal places viewed in complex numbers
 
Hi. Just a comment. The Microsoft article appears to assume a complex number ends in "i"
Note that it could end in "j"

=COMPLEX(3,4,"j")

Another idea for the code might be to use "ImReal" and "Imaginary" as in this idea:

Sub Demo()
Dim s
s = "-3-4j"
With WorksheetFunction
Debug.Print .ImReal(s)
Debug.Print .Imaginary(s)
End With
End Sub

--
HTH :)
Dana DeLouis


"Infinitogool" wrote in message ...

Hi
See if the article at
http://support.microsoft.com/?scid=k...51338&x=11&y=6
does what you want.

Regards,
Pedro J.


=COMPLEX(COS(C9),SIN(C9)) returns 0.564642473395035+0.564642473395035i and we
want 0.56+0.56i

David Biddulph[_2_]

How do I modify the decimal places viewed in complex numbers
 
I'm interested as to what value of C9 gives you that result? I would have
expected COS(C9) and SIN(C9) to have the same +ve value only for
C9=RADIANS(45) [and multiples of 2*PI() beyond that], and in that case the
values would be SQRT(2), not 0.564642473395035

But to answer your formatting question, perhaps
=COMPLEX(ROUND(COS(C9),2),ROUND(SIN(C9),2))
--
David Biddulph

"abbyjaz" wrote in message
...
=COMPLEX(COS(C9),SIN(C9)) returns 0.564642473395035+0.564642473395035i and
we
want 0.56+0.56i





All times are GMT +1. The time now is 11:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com