Introduces a type constructor %math.F for various IEEE-754 floating-point formats and a set of operations to calculate with instances of these types. All operations with the exception of %math.conv expect a Nat just in front of their actual argument. Via this mode you can fine-tune how strictly floating-point transformations must obey IEEE semantics.
Types
%math.F
A floating-point type with p bits of precision and e exponent bits. The sign bit is neither included in p nor in e. Thus, the total number of bits occupied by a value of this type is p + e + 1. Current constant folding only supports IEEE binary16/binary32/binary64 literals, subject to host f16 support.
axm %math.F: «2; Nat» → *;
let %math.f16 = (10, 5);
let %math.f32 = (23, 8);
let %math.f64 = (52, 11);
let %math.bf16 = ( 7, 8);
let %math.nvtf32 = (10, 8);
let %math.amdfp24 = (16, 7);
let %math.pxr24 = (15, 8);
let %math.F16 = %math.F %math.f16;
let %math.F32 = %math.F %math.f32;
let %math.F64 = %math.F %math.f64;
let %math.BF16 = %math.F %math.bf16;
let %math.NVTF32 = %math.F %math.nvtf32; // actually 19 bits; aligns to 32 bit
i: Follows the behavior of libm's fmin/fmax. If either operand is a NaN, returns the other non-NaN operand. Returns NaN only if both operands are NaN; the returned NaN is always quiet. If the operands compare equal, returns a value that compares equal to both operands. This means that fmin(+/-0.0, +/-0.0) could return either -0.0 or 0.0.
I: Follows the semantics of minNum/maxNum specified in the draft of IEEE 754-2018. If either operand is a NaN, returns NaN. Otherwise, returns the lesser of the two arguments. -0.0 is considered to be less than +0.0 for this intrinsic.
((%math.conv.f2f pe -1.0:(%math.F64)), ((%math.conv.f2f pe 0.0:(%math.F64)), (%math.conv.f2f pe 1.0:(%math.F64)))#(%math.cmp.g m (x,(%math.conv.f2f pe 0.0:(%math.F64)))))#(%math.cmp.ge m (x, (%math.conv.f2f pe 0.0:(%math.F64))));