Common — library colibrilib.fp — module Widen

The format with one more bit of significand

The 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).

216
module Widen
217
use int.Int

The rounding modes of IEEE 754

219
type
mode
=
RNE
|
RNA
|
RTP
|
RTN
|
RTZ
220
221
function
windex
(i: int) : int = if 0 <= i then 2 * i else 2 * i + 1
222
223
function
lo_off
(m: mode) (i: int) : int =
224
match m with
225
| RTN -> 0 | RTP -> -2 | RTZ -> if 0 <= i then 0 else -2 | RNE | RNA -> -1
226
end
227
228
function
hi_off
(m: mode) (i: int) : int =
229
match m with
230
| RTN -> 2 | RTP -> 0 | RTZ -> if i < 0 then 0 else 2 | RNE | RNA -> 1
231
end
232
end