How do I modify the decimal places viewed in complex numbers

A

abbyjaz

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

Dana DeLouis

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
 
D

David Biddulph

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))
 
Top