round-to-nearest ( epsilon? mantissa-and-guard rem -- mantissa-and-guard' )


Vocabulary
math.integers.private

Inputs
epsilon?an object
mantissa-and-guardan object
reman object


Outputs
mantissa-and-guard'an object


Definition


: round-to-nearest
( epsilon? mantissa-and-guard rem -- mantissa-and-guard' )
over odd? [
zero?
[ dup 2 bitand zero? not rot or [ 1 + ] when ]
[ nip 1 + ] if
] [ drop nip ] if ; inline