The Float type deals with signed, floating-point numbers, expressed using scientific notation.
Class Methods (see Type)
- New
- Converts an int, symbol or Text value into a float, if possible. Otherwise, it returns null.
Instance Methods
Most binary methods will coerce a passed Integer value to float before performing the method. An attempt to divide non-zero by zero yields +INF or -INF. An attempt to divide zero by zero or take the square-root of -1 yields NaN.
- -@
- Negate the float (flip its sign)
- +
- Add two floats
- -
- Subtract two floats
- *
- Multiply two floats
- /
- Divide two floats
- %
- Return the remainder after dividing two floats (7%2 returns 1)
- **
- self to the power of the second float (2**3 returns 8)
- <=>
- Compare two floats. Return -1 if self is less, 1 if greater, and 0 if equal. Return null if not comparable. pushValue(th, aFloat((Afloat) M_PI)); popProperty(th, 1, "pi"); pushCMethod(th, float_rad); popProperty(th, 1, "Rad");
- Abs
- Absolute value (-1.).Abs returns 1.
- Acos
- arc-cosine(self).
- Asin
- arc-sine(self).
- Atan
- arc-tangent(self). As an alternate form, y.Atan(x) returns the arc-tangent from all four quadrants
- Ceil
- Round the float up to the next integer value.
- Cos
- cosine(self).
- e
- The constant e (2.71828...).
- Exp
- e
self . - float?
- Return true if self is a float, otherwise 'null'.
- Floor
- Round the float down to the next integer value.
- Integer
- Convert to an Integer and return.
- Ln
- natural logarithm of self (base e).
- Log
- Logarithm of self (base 10).
- Max
- Return the larger float. (5.).Max(2.) returns 5.
- Min
- Return the smaller float. (2.).Min(-4.) returns -4.
- Modulus
- Return a float constrained between 0 and the modulus.
- Nan?
- Return true if the float is Nan.
- Next
- Return the next float, essentially adding 1 to it.
- pi
- The constant pi (3.141592...).
- Rad
- convert degrees to radians.
- Sign
- Return 1 if positive, -1 if negative.
- Sin
- sine(self).
- Tan
- tangent(self).
- Text
- Convert to new Text value and return.