Paste: round decimals

Author: blei
Mode: factor
Date: Mon, 8 Jun 2009 14:13:08
Plain Text |
:: decimals ( x n -- x' )
    10 n neg ^ :> pos
    x pos mod :> remain
    x remain -
    remain abs 10 n ^ * round 0 > [ pos x sgn * + ] when ;

Annotation: slightly beautified

Author: blei
Mode: factor
Date: Mon, 8 Jun 2009 14:28:33
Plain Text |
:: decimals ( x n -- x' )
    1/10 n ^ :> pos
    x pos mod :> remain
    x remain -
    remain abs pos recip * round
    0 > [ pos x sgn * + ] when ;

New Annotation

Summary:
Author:
Mode:
Body: