Permalink
Browse files

add Complex rounders (truncate, round, floor, ceiling)

  • Loading branch information...
labster committed Jun 28, 2013
1 parent c98d2d2 commit 71e9f8551c297d7840c3dca9e3bbf4382a2bd92d
Showing with 29 additions and 0 deletions.
  1. +29 −0 S32-setting-library/Numeric.pod
@@ -395,6 +395,35 @@ C<val()>-based representation of complex literals, of the form "C<< <1+2i> >>",
without internal spaces, and including the angles that keep the C<+>
from being treated as a normal addition operator.
+=item floor
+
+ multi method floor ( Complex $x: --> Complex ) is export
+
+Returns the highest integer not greater than each of the real and imaginary
+parts.
+
+=item ceiling
+
+ multi method ceiling ( Complex $x: --> Complex ) is export
+
+Returns the lowest integer not less than each of the real and imaginary parts.
+
+=item round
+
+ multi method round ( Complex $x: $scale = 1 --> Complex ) is export
+
+With no arguments, rounds both the real and imaginary parts to the nearest
+integer and returns the result. If C<$scale> is given, rounds $x to the
+nearest multiple of C<$scale>. Uses the same algorithm as Real.round on
+each part of the number.
+
+=item truncate
+
+ multi method truncate ( Complex $x: --> Complex ) is export
+
+Removes the fractional part of both the real and imaginary parts of the number,
+using Real.truncate, and returns the result.
+
=back
=head2 Trigonometric functions

0 comments on commit 71e9f85

Please sign in to comment.