Helios language/ Builtins/

Real

This is a fixed point real number type with 6 decimal places. Real is designed for use in calculations involving relative fees.

real = 0.001 // 0.1%

Associated functions

from_data

Real::from_data(data: Data) -> Real

sqrt

Calculates the square root of a Real number. The result has a maximal error of 0.000001. Throws an error if the input number is negative.

Real::sqrt(a: Real) -> Real

Operators

Note: any binary operator defined for Real can use Int as either the lhs or rhs.

==

Real == Real -> Bool

!=

Real != Real -> Bool

>=

Real >= Real -> Bool

>

Real > Real -> Bool

<=

Real <= Real -> Bool

<

Real < Real -> Bool

+

Real + Real -> Real

-

Real - Real -> Real

*

Real * Real -> Real

/

Real / Real -> Real

Methods

abs

Returns the absolute value.

Real.abs() -> Real

ceil

Rounds up, returning an Int.

real.ceil() -> Int

floor

Rounds down, returning an Int.

real.floor() -> Int

round

Rounds towards nearest whole number, returning an Int.

real.round() -> Int

trunc

Rounds towards zero, returning an Int.

real.trunc() -> Int

serialize

real.serialize() -> ByteArray

show

real.show() -> String