Core runtime library providing primitive types (Bool, Byte, Char, Int, Float, String), base collections, and system utilities. Every Objeck program links against this bundle automatically via lang.obl.
Float
Float class represents a double-precision floating-point value
Example
pi := Float->Pi(); # 3.14159...
e := Float->E(); # 2.71828...
sq := Float->Sqrt(2.0); # 1.41421...
rnd := Float->Random(); # 0.0–1.0Operations
- Abs
- ArcCos
- ArcCosh
- ArcSin
- ArcSinh
- ArcTan
- ArcTan2
- ArcTanh
- Cbrt
- Ceil
- Clamp
- Clear
- Compare
- Cos
- Cosh
- DoubleFactorial
- E
- Error
- ErrorLine
- Exp
- Factorial
- Floor
- Gamma
- Inf
- IsNeg
- Log
- Log10
- Log2
- Max
- Min
- Mod
- NaN
- NegInf
- Pi
- Pow
- PrintLine
- Random
- Round
- Sign
- Sin
- Sinh
- Sqrt
- Tan
- Tanh
- ToByte
- ToChar
- ToDegrees
- ToInt
- ToRadians
- ToString
- Trunc
Abs # function
Returns the absolute value
function : Abs() ~ FloatReturn
| Type | Description |
|---|---|
| Float | absolute value |
Example
Float->Abs(-3.14)->PrintLine(); # 3.14ArcCos # function
Calculates the cosine value
function : ArcCos() ~ FloatReturn
| Type | Description |
|---|---|
| Float | cosine value |
ArcCosh # function
Calculates the arc-hyperbolic cosine
function : ArcCosh() ~ FloatReturn
| Type | Description |
|---|---|
| Float | hyperbolic arc-cosine value |
ArcSin # function
Calculates the arc-sine value
function : ArcSin() ~ FloatReturn
| Type | Description |
|---|---|
| Float | arc-sine value |
ArcSinh # function
Calculates the arc-hyperbolic sine
function : ArcSinh() ~ FloatReturn
| Type | Description |
|---|---|
| Float | hyperbolic arc-sine value |
ArcTan # function
Calculates the arc-tangent value
function : ArcTan() ~ FloatReturn
| Type | Description |
|---|---|
| Float | arc-tangent value |
ArcTan2 # function
Calculates arc tangent of y/x
function : ArcTan2(y:Float, x:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| y | Float | value |
| x | Float | value |
Return
| Type | Description |
|---|---|
| Float | arc-tangent value |
ArcTanh # function
Calculates the arc-hyperbolic tangent
function : ArcTanh() ~ FloatReturn
| Type | Description |
|---|---|
| Float | hyperbolic arc-tangent value |
Cbrt # function
Calculates the cubic root
function : Cbrt() ~ FloatReturn
| Type | Description |
|---|---|
| Float | cubic root |
Ceil # function
Calculates the ceiling value
function : Ceil() ~ FloatReturn
| Type | Description |
|---|---|
| Float | ceiling value |
Example
Float->Ceil(3.1)->PrintLine(); # 4.0Clamp # function
Returns a given value between an upper and lower bound
function : Clamp(min:Float, value:Float, max:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| min | Float | minimal value |
| value | Float | value between the min and max |
| max | Float | maximum value |
Return
| Type | Description |
|---|---|
| Float | min if vaule is less than main, max if max is less than value, otherwise the value |
Clear # function
Set all array elements to zero
function : Clear(f:Float[]) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| f | Float | array |
Compare # function
Compares two value
function : Compare(l:Float, r:Float) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| l | Float | left compare object |
| r | Float | right compare object |
Return
| Type | Description |
|---|---|
| Int | 0 if equal, -1 if types differ, 1 if equal |
Cos # function
Calculates the cosine value
function : Cos() ~ FloatReturn
| Type | Description |
|---|---|
| Float | cosine value |
Example
angle := Float->Pi() / 3.0;
Float->Cos(angle)->PrintLine(); # 0.5Cosh # function
Calculates the hyperbolic cosine
function : Cosh() ~ FloatReturn
| Type | Description |
|---|---|
| Float | hyperbolic cosine value |
DoubleFactorial # native
Calculates the double factorial of the value
function : native : DoubleFactorial(n:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| n | Float | number |
Return
| Type | Description |
|---|---|
| Float | double factorial of the value |
E # function
Value of E
function : E() ~ FloatReturn
| Type | Description |
|---|---|
| Float | value of E |
Example
Float->E()->PrintLine(); # 2.718281828...Exp # function
Calculates exponential value
function : Exp() ~ FloatReturn
| Type | Description |
|---|---|
| Float | exponential value |
Factorial # function
Calculates the factorial value
function : Factorial(n:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| n | Float | number |
Return
| Type | Description |
|---|---|
| Float | factorial value |
Floor # function
Calculates the floor value
function : Floor() ~ FloatReturn
| Type | Description |
|---|---|
| Float | floor value |
Example
Float->Floor(3.9)->PrintLine(); # 3.0Gamma # function
Calculates the gamma value
function : Gamma() ~ FloatParameters
| Name | Type | Description |
|---|---|---|
Return
| Type | Description |
|---|---|
| Float | gamma value |
Inf # function
Returns a positive infinity value
function : Inf() ~ FloatReturn
| Type | Description |
|---|---|
| Float | positive infinity value |
IsNeg # function
Checks is a number is negative
function : IsNeg() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if negative, false otherwise |
Log # function
Calculates the log value
function : Log() ~ FloatReturn
| Type | Description |
|---|---|
| Float | log value |
Example
Float->Log(Float->E())->PrintLine(); # 1.0Log10 # function
Calculates the common (base-10) logarithm value
function : Log10() ~ FloatReturn
| Type | Description |
|---|---|
| Float | common (base-10) logarithm value |
Example
Float->Log10(1000.0)->PrintLine(); # 3.0Log2 # function
Calculates the binary logarithm
function : Log2() ~ FloatReturn
| Type | Description |
|---|---|
| Float | binary logarithm |
Max # native
Returns the largest float value
function : native : Max(l:Float, r:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| l | Float | value to compare |
| r | Float | value to compare |
Return
| Type | Description |
|---|---|
| Float | largest float value |
Min # native
Returns the smallest float value
function : native : Min(r:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| r | Float | value to compare |
Return
| Type | Description |
|---|---|
| Float | smallest float value |
Mod # function
Calculates the decimal mod
function : Mod(a:Float, b:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| a | Float | value |
| b | Float | value |
Return
| Type | Description |
|---|---|
| Float | decimial mod |
NegInf # function
Returns a negative infinity value
function : NegInf() ~ FloatReturn
| Type | Description |
|---|---|
| Float | negative infinity value |
Pi # function
Value of Pi
function : Pi() ~ FloatReturn
| Type | Description |
|---|---|
| Float | value of Pi |
Example
area := Float->Pi() * 5.0 * 5.0;
"Circle area: {$area}"->PrintLine();Pow # function
Calculates the power value
function : Pow(b:Float, r:Int) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| b | Float | power base |
| r | Int | power to raise |
Return
| Type | Description |
|---|---|
| Float | pseudo power value |
Pow # function
Calculates the power value
function : Pow(b:Float, r:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| b | Float | power base |
| r | Float | power to raise |
Return
| Type | Description |
|---|---|
| Float | pseudo power value |
Example
Float->Pow(2.0, 8.0)->PrintLine(); # 256.0PrintLine # native
Prints values
function : native : PrintLine(v:Float[]) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| v | Float | values to print |
PrintLine # native
Prints values
function : native : PrintLine(v:Float[,]) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| v | Float | values to print |
Random # function
Returns a pseudo random value between 0.0 and 1.0, inclusive
function : Random() ~ FloatReturn
| Type | Description |
|---|---|
| Float | pseudo random value |
Example
r := Float->Random();
"Random 0–1: {$r}"->PrintLine();Random # function
Returns a pseudo random value between 0.0 and max, inclusive
function : Random(max:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| max | Float | maximum value |
Return
| Type | Description |
|---|---|
| Float | pseudo random value |
Example
r := Float->Random(100.0);
"Random 0–100: {$r}"->PrintLine();Random # function
Returns a pseudo random value between 0.0 and 1.0, inclusive
function : Random(range_start:Float, range_end:Float) ~ FloatParameters
| Name | Type | Description |
|---|---|---|
| range_start | Float | minimum value |
| range_end | Float | maximum value |
Return
| Type | Description |
|---|---|
| Float | pseudo random value |
Round # function
Rounds the value
function : Round() ~ FloatReturn
| Type | Description |
|---|---|
| Float | rounded value |
Example
Float->Round(3.7)->PrintLine(); # 4.0Sign # function
Returns the sign of a number
function : Sign() ~ FloatReturn
| Type | Description |
|---|---|
| Float | sign of a number |
Sin # function
Calculates the sine value
function : Sin() ~ FloatReturn
| Type | Description |
|---|---|
| Float | sine value |
Example
angle := Float->Pi() / 6.0;
Float->Sin(angle)->PrintLine(); # 0.5Sinh # function
Calculates the hyperbolic sine
function : Sinh() ~ FloatReturn
| Type | Description |
|---|---|
| Float | hyperbolic sine value |
Sqrt # function
Calculates the square root value
function : Sqrt() ~ FloatReturn
| Type | Description |
|---|---|
| Float | square root value |
Example
Float->Sqrt(16.0)->PrintLine(); # 4.0Tan # function
Calculates the tangent value
function : Tan() ~ FloatReturn
| Type | Description |
|---|---|
| Float | tangent value |
Example
angle := Float->Pi() / 4.0;
Float->Tan(angle)->PrintLine(); # ~1.0Tanh # function
Calculates the hyperbolic tangent
function : Tanh() ~ FloatReturn
| Type | Description |
|---|---|
| Float | hyperbolic tangent value |
ToByte # function
Returns the Character value
function : ToByte() ~ ByteReturn
| Type | Description |
|---|---|
| Byte | value |
ToDegrees # function
Converts the value into degrees
function : ToDegrees() ~ FloatReturn
| Type | Description |
|---|---|
| Float | degree value |
ToInt # function
Returns the Int value
function : ToInt() ~ IntReturn
| Type | Description |
|---|---|
| Int | value |
Example
Float->ToInt(9.99)->PrintLine(); # 9ToRadians # function
Converts the value into radians
function : ToRadians() ~ FloatReturn
| Type | Description |
|---|---|
| Float | radian value |
ToString # native
Returns a string representation of the value
function : native : ToString() ~ StringReturn
| Type | Description |
|---|---|
| String | string representation of the value |
Example
s := Float->ToString(3.14);
s->PrintLine(); # 3.14ToString # function
Returns a fixed-point string representation of the float with a given number of decimal places (rounded). Used by string-interpolation format specifiers, e.g. "{$pi:.2}".
function : ToString(value:Float, precision:Int) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| value | Float | float value |
| precision | Int | number of decimal places (negative is treated as 0) |
Return
| Type | Description |
|---|---|
| String | fixed-point string representation |
Example
Float->ToString(3.14159, 2)->PrintLine(); # 3.14