EgretDoc
Back to Home
Location:system/math

Module

Module documentation.

modulemath
@briefMathematical functions
@detailsProvides portable approximations for common Float operations.
@see
  • index.html

Classes

Classes and inheritance.

Functions

Free functions and class methods.

functionmath::to_float
Signaturefunc to_float(x: Int) -> Float
func to_float(x: Int) -> Float {
    return strconv.parse_float(strconv.itoa(x));
}
@briefConverts to the target representation with `to_float`.
@detailsExecutes the `to_float` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
@returnReturns the operation result as `Float`.
functionmath::pi
Signaturefunc pi() -> Float
func pi() -> Float {
    return 3.141592653589793;
}
@briefProvides the system library operation `pi`.
@detailsExecutes the `pi` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Float`.
functionmath::e
Signaturefunc e() -> Float
func e() -> Float {
    return 2.718281828459045;
}
@briefProvides the system library operation `e`.
@detailsExecutes the `e` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Float`.
functionmath::abs
Signaturefunc abs(x: Float) -> Float
func abs(x: Float) -> Float {
    if x < 0.0 {
        return 0.0 - x;
@briefProvides the system library operation `abs`.
@detailsExecutes the `abs` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
@returnReturns the operation result as `Float`.
functionmath::min
Signaturefunc min(x: Float, y: Float) -> Float
func min(x: Float, y: Float) -> Float {
    if x < y {
        return x;
@briefProvides the system library operation `min`.
@detailsExecutes the `min` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
  • ySecond numeric operand or coordinate value used by the operation.
@returnReturns the operation result as `Float`.
functionmath::max
Signaturefunc max(x: Float, y: Float) -> Float
func max(x: Float, y: Float) -> Float {
    if x > y {
        return x;
@briefProvides the system library operation `max`.
@detailsExecutes the `max` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
  • ySecond numeric operand or coordinate value used by the operation.
@returnReturns the operation result as `Float`.
functionmath::clamp
Signaturefunc clamp(x: Float, lo: Float, hi: Float) -> Float
func clamp(x: Float, lo: Float, hi: Float) -> Float {
    if x < lo {
        return lo;
@briefProvides the system library operation `clamp`.
@detailsExecutes the `clamp` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
  • loLower pointer, index, or numeric boundary used by the operation.
  • hiUpper pointer, index, or numeric boundary used by the operation.
@returnReturns the operation result as `Float`.
functionmath::sqrt
Signaturefunc sqrt(x: Float) -> Float
func sqrt(x: Float) -> Float {
    if x <= 0.0 {
        return 0.0;
@briefProvides the system library operation `sqrt`.
@detailsExecutes the `sqrt` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
@returnReturns the operation result as `Float`.
functionmath::exp
Signaturefunc exp(x: Float) -> Float
func exp(x: Float) -> Float {
    if x < -40.0 {
        return 0.0;
@briefProvides the system library operation `exp`.
@detailsExecutes the `exp` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
@returnReturns the operation result as `Float`.
functionmath::log
Signaturefunc log(x: Float) -> Float
func log(x: Float) -> Float {
    if x <= 0.0 {
        return -1000000000000.0;
@briefProvides the system library operation `log`.
@detailsExecutes the `log` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
@returnReturns the operation result as `Float`.
functionmath::ln
Signaturefunc ln(x: Float) -> Float
func ln(x: Float) -> Float {
    return log(x);
}
@briefProvides the system library operation `ln`.
@detailsExecutes the `ln` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
@returnReturns the operation result as `Float`.
functionmath::log10
Signaturefunc log10(x: Float) -> Float
func log10(x: Float) -> Float {
    return log(x) / log(10.0);
}
@briefProvides the system library operation `log10`.
@detailsExecutes the `log10` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
@returnReturns the operation result as `Float`.
functionmath::pow
Signaturefunc pow(x: Float, y: Float) -> Float
func pow(x: Float, y: Float) -> Float {
    if x <= 0.0 {
        return 0.0;
@briefProvides the system library operation `pow`.
@detailsExecutes the `pow` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
  • ySecond numeric operand or coordinate value used by the operation.
@returnReturns the operation result as `Float`.
functionmath::sigmoid
Signaturefunc sigmoid(x: Float) -> Float
func sigmoid(x: Float) -> Float {
    return 1.0 / (1.0 + exp(0.0 - x));
}
@briefProvides the system library operation `sigmoid`.
@detailsExecutes the `sigmoid` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
@returnReturns the operation result as `Float`.
functionmath::relu
Signaturefunc relu(x: Float) -> Float
func relu(x: Float) -> Float {
    if x > 0.0 {
        return x;
@briefProvides the system library operation `relu`.
@detailsExecutes the `relu` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
  • xInput value.
@returnReturns the operation result as `Float`.

Variables

Class fields (var).