For version 0.7.0.
To top.  Up: ..Shapes..Numeric

..Shapes..Numeric..Math


Core bindings
abs arccos arcsin arctan ceil cos cot floor mod modulo rem round sin sqrt tan

Elementary mathematical functions.
Sections:    Trigonometric functions    Extreme values    Rounding    Remainders of division    Miscellaneous functions

Trigonometric functions

sin
Elementary math library function.
::§Float §Float
Dynamic references:none
Sine of argument in radians.
cos
Elementary math library function.
::§Float §Float
Dynamic references:none
Cosine of argument in radians.
tan
Elementary math library function.
::§Float §Float
Dynamic references:none
Tangent of argument in radians.
cot
Elementary math library function.
::§Float §Float
Dynamic references:none
Coangent of argument in radians.
arcsin
Elementary math library function.
::§Float §Float
Dynamic references:none
Inverse of sine, with result in radians.
arccos
Elementary math library function.
::§Float §Float
Dynamic references:none
Inverse of cosine, with result in radians.
arctan
Elementary math library function.
::§Float §Float
Dynamic references:none
Inverse of tangent, with result in radians.

Extreme values

TODO: Documentation of min and max.

Rounding

floor
Elementary math library function.
::§Float §Integer
Dynamic references:none
Rounding towards negative infinity, giving the largest integer which is not greater than the argument.
With the range of §Float being larger than the range of §Integer, there is risk of overflow, in case of which the behavior is undefined.
ceil
Elementary math library function.
::§Float §Integer
Dynamic references:none
Rounding towards positive infinity, giving the smallest integer which is not less than the argument.
With the range of §Float being larger than the range of §Integer, there is risk of overflow, in case of which the behavior is undefined.
round
Elementary math library function.
::§Float §Integer
Dynamic references:none
Rounding to nearest integer, with half-way cases rounded away from zero.
With the range of §Float being larger than the range of §Integer, there is risk of overflow, in case of which the behavior is undefined.

Remainders of division

Shapes comes with three different remainder functions, each characterized by how the sign of the result is determined. Each function is defined for both §Integer, §Float, and §Length. The difference between the three functions is illustrated by the following example.
Remainder functions
Angry
The three remainder functions, illustrated for both §Integer and §Float cases, and for both positive (left column) and negative (right column) divisors. Lines show the §Float case, with unattained limit values indicated with empty circles. Spots show the §Integer case. It is seen that the §Float case coincides with the §Integer case at integer points.
The illustration is included just for fun — when determining which remainder function to use, it is strongly recommended to do that based on the mathematical characterizations rather than this illustration.

Source: show/hide visit
modulo
dividend::§Integer divisor::§Integer §Integer
Dynamic references:none
Remainder consistent with Euclidean division, always being non-negative. That is, let z denote the result of [modulo x y], where x is the divident and y is the divisor. Then z is the unique number that satisfies both 0 ≤ z < |y| and n y + z = x for some integer n.
Equivalently, z can be compuated as x - [abs y] * [floor (1.0 * x) / [abs y]]..
dividend::§Float divisor::§Float §Float
Dynamic references:none
Generalization of the §Integer case to real values.
dividend::§Length divisor::§Length §Length
Dynamic references:none
Analogous to the §Float case.
mod
dividend::§Integer divisor::§Integer §Integer
Dynamic references:none
Remainder induced by floored division. That is, let z denote the result of [mod x y], where x is the divident and y is the divisor. Then z solves the equation n y + z = x, where the integer n is the fraction x / y rounded towards negative infinity.
Since n y ≤ x if y > 0 and vice versa, the definition implies that z will have the same sign as y and magnitude less than that of y.
dividend::§Float divisor::§Float §Float
Dynamic references:none
Generalization of the §Integer case to real values.
dividend::§Length divisor::§Length §Length
Dynamic references:none
Analogous to the §Float case.
rem
dividend::§Integer divisor::§Integer §Integer
Dynamic references:none
Remainder induced by division rounded towards zero. That is, let z denote the result of [rem x y], where x is the divident and y is the divisor. Then z solves the equation n y + z = x, where the integer n is the fraction x / y rounded towards zero.
Since the magnitude of n y will be no greater than that of x, the definition implies that z will have the same sign as x, and the magnitude of z will be less than that of y.
dividend::§Float divisor::§Float §Float
Dynamic references:none
Generalization of the §Integer case to real values.
dividend::§Length divisor::§Length §Length
Dynamic references:none
Analogous to the §Float case.

Miscellaneous functions

sqrt
Elementary math library function.
::§Float §Float
Dynamic references:none
Square root of non-negative number.
abs
This is the function invoked by the syntax abs-call. The binding is useful when the function needs to be passed around as a value, or if one does not like the special syntax.
Common to all cases of this function, is that the result is some kind of non-negative scalar (that is, a §Float, §Length, or §Integer).
::§Float §Float
Dynamic references:none
Absolute value.
::§Integer §Integer
Dynamic references:none
Absolute value.
::§Length §Length
Dynamic references:none
Unsigned length.
::§FloatPair §Float
Dynamic references:none
Euclidean norm.
::§Coords §Length
Dynamic references:none
Euclidean norm.
::§FloatTriple §Float
Dynamic references:none
Euclidean norm.
::§Coords3D §Length
Dynamic references:none
Euclidean norm.
::§Path §Length
Dynamic references:none
Length of path.
::§Path3D §Length
Dynamic references:none
Length of path.
::§Dash §Length
Dynamic references:none
Length of dash pattern.
Get Shapes at SourceForge.net. Fast, secure and Free Open Source software downloads