benilla-re systems structs docs

s_softFloatZero

global · cmath

Address
0xcf0a3c · 4 bytes, up to 0xcf0a3f
Type
float
Meaning
Holds 0.0, set by 0x7625e0; the floor and ceil read it
Confidence
verified, proof one
Finding
spell/records#software-floats

Finding: Software floats in spell: records

Five routines compute on single-precision bit patterns with integer instructions. They have no case for infinity or NaN, and none checks exponent overflow.

routineresult
0x761260 int to float0 for 0; else sign, exponent from the top set bit, the magnitude shifted to 24 bits, low bits dropped
0x760be0 multiplywith either fraction 0: 0 if either exponent is 0, else the exponent sum with the other fraction; else the high word of the two left-aligned 24-bit significands, truncated; either way 0 when the exponent sum less the bias, before any carry, is below 1
0x760e20 addthe other operand when an exponent is 0; the larger when exponents differ by 23 or more; else two's-complement significands with a guard bit, the smaller sar-aligned, summed, renormalized by shifts, truncated; a zero sum is +0
0x760fb0 floorexact for finite inputs; under 1 in magnitude, −1.0 for a negative nonzero value, else +0.0
0x761040 ceilexact for finite inputs; under 1 in magnitude, +0.0 for a negative nonzero value, else 1.0, zero included

The derivation is in the doc.