method unpolar

Documentation for method unpolar assembled from the following types:

class routines

From routines

(routines) routine unpolar

Defined as:

method unpolar(Real $angle)
multi sub unpolar(Real $magReal $angle)

Returns a Complex with the coordinates corresponding to the angle in radians and magnitude corresponding to the object value or $mag in the case it's being used as a sub

say 1.unpolar(⅓*pi);
# OUTPUT: «0.5000000000000001+0.8660254037844386i␤» 

class Cool

From Cool

(Cool) method unpolar

Defined as:

method unpolar(Numeric(Cool))

Coerces the arguments (including the invocant in the method form) to Numeric, and returns a complex number from the given polar coordinates. The invocant (or the first argument in sub form) is the magnitude while the argument (i.e. the second argument in sub form) is the angle. The angle is assumed to be in radians.

say sqrt(2).unpolar(pi/4);      # OUTPUT: «1+1i␤»