R/MRatCalcpowered by RiX

RiX walkthrough 14 e

Optional Float math

Load IEEE-754 approximate math without making it a core RiX numeric type.

Load float only when a calculation intentionally needs IEEE-754 behavior:

Runnable RiX

value.Float() is the receiver-first spelling of the same explicit conversion. The method appears on integers and rationals only while the plugin is loaded; neither spelling permits exact arithmetic to become approximate silently.

Mixed expressions are deliberately rejected:

Runnable RiX

By contrast, 1/2 + .float(1/3) is an error: choose an explicit conversion. The same rule covers comparisons, Min/Max, and certified-real arithmetic. No real backend silently turns itself into Float, and Float never enters the automatic Oracle bridge.

The package owns the Float semantic type and the .float command namespace. This keeps other future numerical plugins—interval oracles, Cauchy sequences, continued fractions—from competing for a single global approximate type.

For display-oriented decimal work, rounding is explicit:

Runnable RiX

The results preserve the actual stored IEEE value, rather than pretending that the input was a decimal real number.

Choose the storage format explicitly when binary32 behavior is relevant:

Runnable RiX

Operations round back to the receiver format. Mixing binary32 and binary64 is an error until one side is converted explicitly. NextUp, NextDown, and NextAfter provide deterministic adjacent representable values without claiming anything about the real number that may have produced the Float.

Exceptional values remain inspectable:

Runnable RiX

Classify() returns a rix.float.classification@1 record. Its class, sign, format, operation, and diagnostic sequence distinguish overflow, underflow, signed zero, subnormals, infinities, and NaN. .float.Interval rejects non-finite stored values instead of inventing an enclosure.

With .numerics, Float is an honest sampling backend rather than a refiner:

Runnable RiX

The point interval in sample exactly identifies the stored binary32 or binary64 value. It does not certify the intended real that led to that value, so neither Numerics nor a Halo comparison promotes it to proof.

Reproducible reductions make both order and rounding policy explicit:

Runnable RiX

The error estimate is deliberately labeled approximate, not certified. For complex IEEE work, use the separate Float-complex schema:

Runnable RiX

These values never acquire the exact Complex type or its arithmetic overloads.

Typed tensor multiplication

Runnable RiX