All examples
Scientific computing

Explicit numerical closeness

Use math.close with fixed defaults or explicit relative and absolute error margins.

float_comparison.aner
import aner.math

print(0.1 + 0.2 == 0.3)           // false
print(math.close(0.1 + 0.2, 0.3)) // true

let relative_tolerance = 1e-6
let absolute_tolerance = 1e-10
print(math.close(1000000.0, 1000000.5, relative: relative_tolerance)) // true
print(math.close(1e-12, 0.0, relative: 0.0, absolute: absolute_tolerance)) // true
print(math.close(1e-12, 0.0)) // false
print(math.close(0.1 + 0.2, 0.3, relative: 0.0, absolute: 0.0)) // false

Make it your experiment.

Use a compatible Aner runtime. Save this program as examples/float_comparison.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/float_comparison.aner
aner run examples/float_comparison.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Use a compatible current native Aner executable. This complete example runs locally with the declared inputs; the guide explains exact shapes, expected results and resource limits.

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner