E1135: deterministic code uses floating point

View source

A verb marked meta deterministic must give the same result on every target.

A verb marked meta deterministic must give the same result on every target. Floating-point results can differ between targets, so the verb may not declare, receive, return or compute f32 or f64 values (ADR-0100). The check also covers calls, so a deterministic verb cannot call a verb that has a floating-point signature. The error points at the first use.

Example

actus
meta deterministic
verb half() -> Int {
    erg ratio: f32 = 0.5f32;
    return 1;
}

verb main() {
}

Fix

Use integers, for example fixed-point values with a scale that you choose.

actus
meta deterministic
verb half() -> Int {
    erg ratio: Int = 5;
    return ratio / 10;
}

verb main() {
}

Run actus explain E1135 in your terminal to read this entry offline. Browse Modules & rules or all error codes.