Browse documentation
Getting started

Numeric types

Explore Number, fixed width integers and Float32, checked overflow, packed arrays and explicit precision loss.

Implemented

Aner provides Number, fixed width integers and Float32, including packed arrays and Tensor conversions that preserve dtype. Int64 is the default integer type and Float64 the default floating type.

Find the numeric type you need

Start with Number when a scalar variable or function should accept different numeric representations. A Number value retains its concrete integer, Float32 or Float64 type. It is not an arbitrary precision value, an automatic choice of the smallest storage, or a packed array element type. Use the fixed width integer guide for exact ranges and checked overflow, or the Float32 guide for explicit precision and packed storage.

Run the examples

The complete Number example, integer example and Float32 example require a compatible native runtime with these numeric capabilities. See Downloads for available packages.

With a compatible runtime installed, save a complete source example in your experiment folder, then check and run it:

sh
aner check examples/float32.aner
aner run examples/float32.aner

The examples contain their own inputs and need no external service, dataset or credentials. The Float32 Tensor example uses CPU execution. Optional accelerator backends retain their own hardware and build requirements.

Numeric contracts

  • Number is an import free scalar abstraction that preserves the concrete integer, Float32 or Float64 representation.
  • Integer types include Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64 and UInt64, with checked ranges, checked overflow and compact packed arrays.
  • Float32 provides IEEE 754 binary32 scalars and four byte packed payload slots in Array, DynamicArray and NDArray.
  • Tensor bridges preserve Float32 or Float64 dtype, require an explicit matching destination type, and return detached copies.

Automatic numeric conversions must preserve the actual value. Explicit constructors such as Float32(value) or explicit array casts permit documented rounding; checked integer constructors reject values outside their destination range. Float32 widens exactly to Float64. Integer division with / produces Float64; use integer_div for checked integer division. Number does not choose smaller storage based on a value's magnitude and is not a packed array element type.

The Float32 guide describes precision boundaries, typed array conversions, Tensor rank limits and gradient behavior. Int128 and UInt128 remain future work.

Keep earlier experiments reproducible

Retain the original executable and recorded inputs for historical results. aner versions lists local installations, and aner rollback restores the previous selected runtime without downloading it.

Each guide and example retains its capability, device and editor requirements. Check runtime availability and the verified systems on Downloads.

Aner documentation · Reference and guides