namespace sys.core.lang
class Float
A class representing a 32 bit floating point number.
It maps exactly to a 32 bit CPU resource and has no overhead. Because of this strict mapping it can't have extra non-static member variables, can't be inherited from and can't have virtual methods.
this Saturated{value: Float};
this Saturated{value: Double};
Constructs a saturated Float based on the input value.
value | the input value |
---|
def Clamp(min: Float, max: Float);
Clamps the current mutable instance between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
func Clamped(min: Float, max: Float): Float;
Returns the current instance clamped between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
the clamped value
func Pow(exp: Float): Float;
Raises the instance to an exponent.
exp | the exponent |
---|
the exponential
func ToString(): String;
Converts the value to a Utf8 string.
the resulting string
func @write(ref stream: Stream);
func @write(ref stream: Stream, format: OutputFormat);
Writes the value to an Utf8 text stream.
Can use an optional output format specifier.
stream | the output stream |
---|---|
format | formatting information |
func @put(ref stream: Stream);
Writes the value to a binary stream as a 32 bit floating point.
stream | the output stream |
---|
def @get(ref stream: Stream);
Reads a 32 bit floating point from a binary stream.
stream | the input stream |
---|
property IsNan: Bool; get;
Return true if the instance is not a number.
property IsInfinite: Bool; get;
Return true if the infinite.
property Abs: Float; get;
Returns the absolute value.
property Sqr: Float; get;
Returns the square of the value value.
property Sqrt: Float get = Math.Sqrt;
Returns the square root of the value.
property Floor: Float get = Math.Floor;
Returns the floor of a floating point value.
property Ceil: Float get = Math.Ceil;
Returns the ceiling of a floating point value.
property Round: Float get = Math.Round;
Returns the rounded value of a floating point.
property Trunc: Float get = Math.Trunc;
Returns the value truncated to the nearest integer value.
property Sin: Float get = Math.Sin;
Returns the sine of the value.
property Cos: Float get = Math.Cos;
Returns the cosine of the value.
property Tan: Float get = Math.Tan;
Returns the tangent of the value.
property Sinh: Float get = Math.Sinh;
Returns the hyperbolic sine of the value.
property Cosh: Float get = Math.Cosh;
Returns the hyperbolic cosine of the value.
property Tanh: Float get = Math.Tanh;
Returns the hyperbolic tangent of the value.
property Asin: Float get = Math.Asin;
Returns the arcsine of the value.
property Acos: Float get = Math.Acos;
Returns the arccosine of the value.
property Atan: Float get = Math.Atan;
Returns the arctangent of the value.
property Asinh: Float get = Math.Asinh;
Returns the hyperbolic arcsine of the value.
property Acosh: Float get = Math.Acosh;
Returns the hyperbolic arccosine of the value.
property Atanh: Float get = Math.Atanh;
Returns the hyperbolic arctangent of the value.
property Log: Float get = Math.Log;
Returns the natural logarithm of a value.
property Log2: Float get = Math.Log2;
Returns the base 2 logarithm of a value.
property Log10: Float get = Math.Log10;
Returns the base 10 logarithm of a value.
const Zero: Float;
A Float instance representing a logical "0" value.
const One: Float;
A Float instance representing a logical "1" value.
const Min: Float;
The minimum value for a Float (32 bit floating point) instance.
const Max: Float;
The maximum value for a Float (32 bit floating point) instance.
const IsSigned;
Returns true if the floating point representation is signed.
const IsInteger;
Returns false.
const MaxDigitsLow;
The lower limit for the number of base 10 digits that are needed to represent a maximal value in textual form.
In base 10, you can have MaxDigitsLow digits that go though values 0-9.
Should not be used for buffer sizes.
const MaxDigitsHigh;
The upper limit for the number of base 10 digits that are needed to represent a maximal value in textual form.
In base 10, the `MaxDigitsHigh - MaxDigitsLow` most significant digits can't go though values 0-9 because they do not fit the binary representation.
Should not be used for buffer sizes.
const Nan;
The not a number value.
const Infinite;
Positive infinite.