• Marius Gerbershagen's avatar
    format: fix exponential floating point output · 2b7d0bdb
    Marius Gerbershagen authored
        sys::scale-exponent was not working correctly and outputting
        numbers in the wrong range. Furthermore, using sys::scale-exponent
        for scaling the number to the correct range is flawed anyway,
        since it introduces rounding errors. Hence we replace
        sys::scale-exponent by the much simpler sys::exponent-in-base10
        function and fix the logic in format-exp-aux to scale using
        sys::flonum-to-string, which is rounding error free. Moreover,
        sys::flonum-to-string was buggy and not rounding numbers correctly
        when the 'd' parameter was given, which has also been fixed.
        Fixes #437.
    2b7d0bdb
format.lsp 123 KB