All examples
Scientific computing

Checked native scalar mathematics

Run native Float64 mathematical functions with explicit domain and range contracts.

math_basic.aner
// Native scalar Float64 mathematics; requires the updated development runtime.
import aner.math

let hypotenuse = math.sqrt(math.pow(base: 3.0, exponent: 2.0) + math.pow(4.0, 2.0))
print(hypotenuse)
print(math.abs(-3.5))
print(math.pow(exponent: 3.0, base: -2.0))
print(math.exp(0.0))
print(math.log(1.0))
print(math.sin(0.0))
print(math.cos(0.0))
print(math.tan(0.0))
print(math.sqrt(Float64(4)))
print(math.pow(0.0, 0.0))

let pi = 3.141592653589793
print(math.abs(math.sin(pi / 6.0) - 0.5) < 0.000000000001)

Make it your experiment.

With Aner installed, save this program as examples/math_basic.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/math_basic.aner
aner run examples/math_basic.aner

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

Use the updated native Aner development runtime with aner.math, defaults, contextual outcome constructors, checked array selectors and Result propagation. Older packaged executables may predate this syntax. Build the current source or select a compatible updated development executable; the guide distinguishes implemented capabilities from planned unit bearing arrays, records and typed parallel results. The revised source requires the updated development runtime; older packaged executables may reject the new syntax.

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