library colibrilib.fp — module WidenThe float of index i is at windex i in the format with one more bit of significand; the reals that round to the float of index i or above are above the float windex i + lo_off m i of that format, those that round to it or below under windex i + hi_off m i (Intf.round_f_ge_thr, round_f_le_thr).
module Widen216use int.Int217
The rounding modes of IEEE 754
type mode = RNE | RNA | RTP | RTN | RTZ219220function windex (i: int) : int = if 0 <= i then 2 * i else 2 * i + 1221222function lo_off (m: mode) (i: int) : int =223match m with224| RTN -> 0 | RTP -> -2 | RTZ -> if 0 <= i then 0 else -2 | RNE | RNA -> -1225end226227function hi_off (m: mode) (i: int) : int =228match m with229| RTN -> 2 | RTP -> 0 | RTZ -> if i < 0 then 0 else 2 | RNE | RNA -> 1230end231end232