Handbook
Glossary
round-binary-shift ( n amount -- rounded )
Vocabulary
math
.
floats
.
small
.
private
Inputs
n
an
object
amount
an
object
Outputs
rounded
an
object
Definition
USING:
kernel
math
;
IN:
math.floats.small.private
::
round-binary-shift
( n amount -- rounded )
amount 0
>=
[
n amount
shift
]
[
amount
neg
:>
discarded n discarded
neg
shift
:>
q n q discarded
shift
-
:>
remainder 1 discarded 1
-
shift
:>
midpoint remainder midpoint
>
remainder midpoint
=
q
odd?
and
or
[
q 1
+
]
[
q
]
if
]
if
;