Handbook
Glossary
reduce-magnitude ( n multiplier base suffixes -- string )
Vocabulary
units
.
reduction
Inputs
n
an
object
multiplier
an
object
base
an
object
suffixes
an
object
Outputs
string
an
object
Definition
USING:
kernel
math
math.functions
math.parser
sequences
;
IN:
units.reduction
::
reduce-magnitude
( n multiplier base suffixes -- string )
n 0
<
[
n
neg
multiplier base suffixes
reduce-magnitude
"-"
prepend
]
[
suffixes n multiplier base
find-unit-suffix
:>
i n multiplier i
*
base
swap
^
/i
number>string
i suffixes
nth
append
]
if
;