namespace sys.core.lang
class Long
A class representing a 64 bit signed integer.
It maps exactly to a 64 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{string: String};
Parses a string an constructs a Long based on it.
string | string to parse |
---|
this Saturated{value: Long};
this Saturated{value: QWord};
this Saturated{value: Double};
this Saturated{value: String};
Constructs a saturated Long based on the input value.
value | the input value. Can be numeric or a string. |
---|
def Clamp(min: Long, max: Long);
Clamps the current mutable instance between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
func Clamped(min: Long, max: Long): Long;
Returns the current instance clamped between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
the clamped value
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 64 bit signed integer.
stream | the output stream |
---|
def @get(ref stream: Stream);
Reads a 64 bit signed integer from a binary stream.
stream | the input stream |
---|
property Abs: Long; get;
Returns the absolute value.
In the case of Long it returns the value itself and is included only for API compatibility when using templates.
property Sqr: Long; get;
Returns the square of the value value.
property Sqrt: Long; get;
Returns the square root of the value, rounded down.
property Floor: Long; get;
Returns the floor of a floating point value.
In the case of Long it returns the value itself and is included only for API compatibility when using templates.
property Ceil: Long; get;
Returns the ceiling of a floating point value.
In the case of Long it returns the value itself and is included only for API compatibility when using templates.
property Round: Long; get;
Returns the rounded value of a floating point.
In the case of Long it returns the value itself and is included only for API compatibility when using templates.
property Trunc: Long; get;
Returns the value truncated to the nearest integer value.
In the case of Long it returns the value itself and is included only for API compatibility when using templates.
const Zero: Long;
A Long instance representing a logical "0" value.
const One: Long;
A Long instance representing a logical "1" value.
const Min: Long;
The minimum value for a Long (64 bit signed integer) instance.
const Max: Long;
The maximum value for a Long (64 bit signed integer) instance.
const IsSigned;
true if the numeric representation uses two's complement signed values, false otherwise.
const IsInteger;
true if the numeric representation is an integer, false if it is a floating point.
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 through 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 through values 0-9 because they do not fit the binary representation.
Should not be used for buffer sizes.