Float
IEEE 754 double-precision floating-point numbers. Arithmetic operators
(+, -, *, /) and comparisons (<, >) are VM primitives and
accept both Float and SmallInteger arguments.
1.5 + 2.5 >>> 4.0
2.5 negated >>> -2.5
3.0 max: 5.0 >>> 5
0.0 isZero >>> true
0.0 sin >>> 0
0.0 cos >>> 1
0.0 tan >>> 0
0.0 asin >>> 0
1.0 acos >>> 0
0.0 atan >>> 0
1.0 atan2: 1.0 >>> 0.7853981633974483
1.0 ln >>> 0
1.0 log10 >>> 0
8.0 log: 2.0 >>> 3
0.0 exp >>> 1
2.0 pow: 10.0 >>> 1024
"Compute the hypotenuse of a 3-4-5 right triangle"
((3.0 * 3.0) + (4.0 * 4.0)) sqrt
Class Methods
primitives
Return Euler's number e (2.71828...).
Return positive infinity.
Return NaN (not a number).
Return the constant pi (3.14159...).
Instance Methods
primitives
Return the product of the receiver and the argument.
Return the sum of the receiver and the argument.
Return the difference of the receiver and the argument.
Return the receiver divided by the argument.
Return true if the receiver is less than the argument.
Return true if the receiver is greater than the argument.
Return the arc cosine of the receiver. Result in radians.
Return the arc sine of the receiver. Result in radians.
Return the arc tangent of the receiver. Result in radians.
Return the arc tangent of y/x (receiver is y, argument is x), using the signs of both to determine the quadrant. Result in radians.
Return the cosine of the receiver (in radians).
Return e raised to the power of the receiver.
Return the natural logarithm (base e) of the receiver.
Return the base-10 logarithm of the receiver.
Return the logarithm of the receiver in the given base.
Return the receiver raised to the given power.
Return the sine of the receiver (in radians).
Return the square root of the receiver.
Return the tangent of the receiver (in radians).
uncategorized
Return the absolute value of the receiver.
(0.0 - 5.5) abs >>> 5.5
3.14 abs >>> 3.14
0.0 abs >>> 0
Return the smallest integer greater than or equal to the receiver.
Delegates to the primCeiling VM primitive.
3.2 ceiling "=> 4"
Return the largest integer less than or equal to the receiver.
Delegates to the primFloor VM primitive.
3.7 floor "=> 3"
Return true if the receiver is equal to zero.
0.0 isZero >>> true
3.14 isZero >>> false
Return the larger of the receiver and other.
3.0 max: 5.0 >>> 5
5.0 max: 3.0 >>> 5
Return the smaller of the receiver and other.
3.0 min: 5.0 >>> 3
5.0 min: 3.0 >>> 3
Return the arithmetic negation of the receiver.
2.5 negated >>> -2.5
0.0 negated >>> -0
(0.0 - 7.0) negated >>> 7
Return true if the receiver is less than zero.
(0.0 - 1.0) negative >>> true
0.0 negative >>> false
3.0 negative >>> false
Return true if the receiver is greater than zero.
3.0 positive >>> true
0.0 positive >>> false
(0.0 - 1.0) positive >>> false
Return a string representation of the receiver. Delegates to the
primPrintString VM primitive, which uses Go's %g format
(trailing zeroes are omitted, e.g. 5.0 prints as 5).
3.14 printString "=> '3.14'"
Return the nearest integer to the receiver (rounding half away
from zero). Returns a SmallInteger. Delegates to primRounded.
3.5 rounded "=> 4"
3.4 rounded "=> 3"
Return -1.0, 0.0, or 1.0 depending on whether the receiver is negative, zero, or positive.
3.0 sign >>> 1
(0.0 - 3.0) sign >>> -1
0.0 sign >>> 0
Truncate the receiver toward zero, returning a SmallInteger.
Delegates to primTruncated.
3.9 truncated "=> 3"
(0.0 - 3.9) truncated "=> -3"