parrotcode: WMLScript Float library | |
Contents | Language Implementations | WMLScript |
runtime/wmlsfloat.pir - WMLScript Float library
This library contains a set of typical arithmetic floating-point functions that are frequently used by applications.
See "WMLScript Standard Libraries Specification", section 8 "Float".
int(value)
Returns the integer part of the given value. If the value is already an integer, the result is the value itself.
value = Number
Integer or invalid.
floor(value)
Returns the greatest integer value that is not greater than the given value. If the value is already an integer, the result is the value itself.
value = Number
Integer or invalid.
ceil(value)
Returns the smallest integer value that is not less than the given value. If the value is already an integer, the result is the value itself.
value = Number
Integer or invalid.
pow(value1, value2)
Returns an implementation-dependent approximation to the result of raising value1 to the power of value2. If value1 is a negative number then value2 must be an integer.
value1 = Number
value2 = Number
Floating-point or invalid.
If value1 == 0 and value2 < 0 then invalid
is returned.
If value1 < 0 and value2 is not an integer then invalid
is returned.
round(value)
Returns the number value that is closest to the given value and is equal to a mathematical integer. If two integer number values are equally close to the value, the result is the larger number value. If the value is already an integer, the result is the value itself.
value = Number
Integer or invalid.
sqrt(value)
Returns an implementation-dependent approximation to the square root of the given value.
value = Floating-point
Floating-point or invalid.
If value is a negative number then invalid is returned.
maxFloat()
Returns the maximum floating-point value supported by [IEEE754] single precision floating-point format.
Floating-point 3.40282347e+38.
minFloat()
Returns the smallest nonzero floating-point value supported by [IEEE754] single precision floating-point format.
Floating-point. Smaller than or equal to the normalised minimum single precision floating-point value: 1.17549435e-38.
Francois Perrad.
|