Checked native scalar mathematics
Run native Float64 mathematical functions with explicit domain and range contracts.
// 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))
print(math.abs(math.sin(math.pi / 6.0) - 0.5) < 0.000000000001)
print(math.log2(8))
print(math.log10(1000))
print(math.round(3.7))
print(math.round(2.5))
print(math.floor(-3.2))
print(math.ceil(3.2))
print(type(math.pi))
print(math.tau == 2.0 * math.pi)
print(math.abs(math.log(math.e) - 1.0) < 0.000000000001)
print(7 / 2)
Make it your experiment.
Use Aner 0.0.3 or newer. 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.
aner check examples/math_basic.aner
aner run examples/math_basic.anerThe aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.
Use Aner 0.0.4 or newer with aner.math, defaults, contextual outcome constructors, checked array selectors and Result propagation. Use a compatible runtime with the documented capabilities; records and typed parallel results remain planned. The revised source requires Aner 0.0.4 or newer; earlier executables may reject the 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