reduce-magnitude ( n multiplier base suffixes -- string )


Vocabulary
units.reduction

Inputs
nan object
multiplieran object
basean object
suffixesan object


Outputs
stringan object


Definition


:: 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 ;