make-rectangular -- r7rs Definition procedure;
make-rectangular (from vonuvoli);Procedure variants:
(((x real-not-inf-not-nan) real-zero) -> ((x real-not-inf-not-nan)))
x of type real-not-inf-not-nan;real-zero;x of type real-not-inf-not-nan;((real-not-inf-not-nan real-not-inf-not-nan) -> (complex-not-inf-not-nan))
real-not-inf-not-nan;real-not-inf-not-nan;complex-not-inf-not-nan;scheme:complex -- (scheme complex);scheme -- (scheme);(make-rectangular x_1 x_2) (make-polar x_3 x_4) (real-part z) (imag-part z) (magnitude z) (angle z)Let
x_1,x_2,x_3, andx_4be real numbers andzbe a complex number such thatz = x_1 + x_2*i = x_3 * e^(x_4*i)Then all of(make-rectangular x_1 x_2) ===> z (make-polar x_3 x_4) ===> z (real-part z) ===> x_1 (imag-part z) ===> x_2 (magnitude z) ===> | x_3 | (angle z) ===> x_angleare true, where
-pi <= x_angle <= piwithx_angle = x_4 + 2 pi nfor some integern.The
make-polarprocedure may return an inexact complex number even if its arguments are exact. Thereal-partandimag-partprocedures may return exact real numbers when applied to an inexact complex number if the corresponding argument passed tomake-rectangularwas exact.Rationale: The
magnitudeprocedure is the same asabsfor a real argument, butabsis in the base library, whereasmagnitudeis in the optional complex library.
The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.