Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Snapshot · Oct 24, 2026 · Frozen documentation

FloatingMath

Computes square root for f16.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Module std.math

import std.math;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

Sqrt

pub fn Sqrt(Value: f16) -> f16

Computes square root for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Sqrt

pub fn Sqrt(Value: f32) -> f32

Computes square root for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Sqrt

pub fn Sqrt(Value: f64) -> f64

Computes square root for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Cbrt

pub fn Cbrt(Value: f16) -> f16

Computes real cube root for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Cbrt

pub fn Cbrt(Value: f32) -> f32

Computes real cube root for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Cbrt

pub fn Cbrt(Value: f64) -> f64

Computes real cube root for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Sin

pub fn Sin(Value: f16) -> f16

Computes sine of a radian angle for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Sin

pub fn Sin(Value: f32) -> f32

Computes sine of a radian angle for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Sin

pub fn Sin(Value: f64) -> f64

Computes sine of a radian angle for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Cos

pub fn Cos(Value: f16) -> f16

Computes cosine of a radian angle for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Cos

pub fn Cos(Value: f32) -> f32

Computes cosine of a radian angle for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Cos

pub fn Cos(Value: f64) -> f64

Computes cosine of a radian angle for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Tan

pub fn Tan(Value: f16) -> f16

Computes tangent of a radian angle for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Tan

pub fn Tan(Value: f32) -> f32

Computes tangent of a radian angle for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Tan

pub fn Tan(Value: f64) -> f64

Computes tangent of a radian angle for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Asin

pub fn Asin(Value: f16) -> f16

Computes inverse sine in radians for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Asin

pub fn Asin(Value: f32) -> f32

Computes inverse sine in radians for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Asin

pub fn Asin(Value: f64) -> f64

Computes inverse sine in radians for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Acos

pub fn Acos(Value: f16) -> f16

Computes inverse cosine in radians for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Acos

pub fn Acos(Value: f32) -> f32

Computes inverse cosine in radians for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Acos

pub fn Acos(Value: f64) -> f64

Computes inverse cosine in radians for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Atan

pub fn Atan(Value: f16) -> f16

Computes inverse tangent in radians for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Atan

pub fn Atan(Value: f32) -> f32

Computes inverse tangent in radians for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Atan

pub fn Atan(Value: f64) -> f64

Computes inverse tangent in radians for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Atan2

pub fn Atan2(Y: f16, X: f16) -> f16

Computes quadrant-aware inverse tangent in radians for f16. Y: Numeric input passed by value; angles use radians. X: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Atan2

pub fn Atan2(Y: f32, X: f32) -> f32

Computes quadrant-aware inverse tangent in radians for f32. Y: Numeric input passed by value; angles use radians. X: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Atan2

pub fn Atan2(Y: f64, X: f64) -> f64

Computes quadrant-aware inverse tangent in radians for f64. Y: Numeric input passed by value; angles use radians. X: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Exp

pub fn Exp(Value: f16) -> f16

Computes base-e exponential for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Exp

pub fn Exp(Value: f32) -> f32

Computes base-e exponential for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Exp

pub fn Exp(Value: f64) -> f64

Computes base-e exponential for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Exp2

pub fn Exp2(Value: f16) -> f16

Computes base-two exponential for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Exp2

pub fn Exp2(Value: f32) -> f32

Computes base-two exponential for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Exp2

pub fn Exp2(Value: f64) -> f64

Computes base-two exponential for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Log

pub fn Log(Value: f16) -> f16

Computes natural logarithm for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Log

pub fn Log(Value: f32) -> f32

Computes natural logarithm for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Log

pub fn Log(Value: f64) -> f64

Computes natural logarithm for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Log2

pub fn Log2(Value: f16) -> f16

Computes base-two logarithm for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Log2

pub fn Log2(Value: f32) -> f32

Computes base-two logarithm for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Log2

pub fn Log2(Value: f64) -> f64

Computes base-two logarithm for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Log10

pub fn Log10(Value: f16) -> f16

Computes base-ten logarithm for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Log10

pub fn Log10(Value: f32) -> f32

Computes base-ten logarithm for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Log10

pub fn Log10(Value: f64) -> f64

Computes base-ten logarithm for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Pow

pub fn Pow(Base: f16, Exponent: f16) -> f16

Computes base raised to an exponent for f16. Base: Numeric input passed by value; angles use radians. Exponent: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Pow

pub fn Pow(Base: f32, Exponent: f32) -> f32

Computes base raised to an exponent for f32. Base: Numeric input passed by value; angles use radians. Exponent: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Pow

pub fn Pow(Base: f64, Exponent: f64) -> f64

Computes base raised to an exponent for f64. Base: Numeric input passed by value; angles use radians. Exponent: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Floor

pub fn Floor(Value: f16) -> f16

Computes integer-valued floor for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Floor

pub fn Floor(Value: f32) -> f32

Computes integer-valued floor for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Floor

pub fn Floor(Value: f64) -> f64

Computes integer-valued floor for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Ceil

pub fn Ceil(Value: f16) -> f16

Computes integer-valued ceiling for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Ceil

pub fn Ceil(Value: f32) -> f32

Computes integer-valued ceiling for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Ceil

pub fn Ceil(Value: f64) -> f64

Computes integer-valued ceiling for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Truncate

pub fn Truncate(Value: f16) -> f16

Computes integer-valued truncation toward zero for f16. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Truncate

pub fn Truncate(Value: f32) -> f32

Computes integer-valued truncation toward zero for f32. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Truncate

pub fn Truncate(Value: f64) -> f64

Computes integer-valued truncation toward zero for f64. Value: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Remainder

pub fn Remainder(Value: f16, Divisor: f16) -> f16

Computes remainder after quotient truncation toward zero for f16. Value: Numeric input passed by value; angles use radians. Divisor: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained. Note: Computes through f32, then rounds to f16; no correctly-rounded transcendental promise.

Remainder

pub fn Remainder(Value: f32, Divisor: f32) -> f32

Computes remainder after quotient truncation toward zero for f32. Value: Numeric input passed by value; angles use radians. Divisor: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Remainder

pub fn Remainder(Value: f64, Divisor: f64) -> f64

Computes remainder after quotient truncation toward zero for f64. Value: Numeric input passed by value; angles use radians. Divisor: Numeric input passed by value; angles use radians. Return: Native IEEE result; domain/range errors produce NaN/infinity rather than exceptions. Note: Safe runtime call. No input borrow or managed allocation is retained.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library