Skip to content
Konjure / spatial intelligence

Number

← Builtin reference

A finite IEEE 754 binary64 scalar with canonical language type f64.

Signature

Number remains a source alias for f64 and this host representation remains compatible with native spatial interfaces. Literals without numeric context default to f64. Exact integer widths and f16/f32/f128 use Scalar instead. Numeric variables never implicitly change dtype; use .convert[T]() for an explicit conversion, which rejects overflow and loss of information.

Methods

sin

sin() -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

cos

cos() -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

sqrt

sqrt() -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

abs

abs() -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

floor

floor() -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

ceil

ceil() -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

min

min(f64) -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

max

max(f64) -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

clamp

clamp(f64, f64) -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

pow

pow(f64) -> Res[f64, DataError]

Returns the numeric result or DataError when the operation cannot be represented.

convert

convert[U]() -> Res[U, DataError]

Converts to explicit numeric dtype U or returns DataError when exact conversion fails.

Examples

Calculate a distance

Change either side length and inspect the hypotenuse.

Tick 0 · 0.00 s⌘ / Ctrl + EnterThis device
main.kj
Loading the language runtime…
Output 0
No output.
Expected output
5

Rust definition

Value::Number(f64); one finite Rust f64 per language value.

See Numeric types for exact integer widths and floating-point formats.

See also