decimal-decode-float  float &optional nsig

string ; scale ; sign

Decodes the floating point number float to a decimal representation. The string string is a sequence of significant digits with no leading or trailing zero.

The scale exponent scale returned indicates the relative position of the decimal dot with respect to the string returned. It may be outside the string. The values returned could be interpreted as a real by

    (* (parse-integer string)
       (expt 10 (- scale (length string))))

In case the floating pointer number is zero, the string is the empty string "" and scale is zero.

If float is negative then the returned sign is less than zero, and greater than zero otherwise.

When nsig is nil (the default) as many digits are produced as necessary. When nsig is given it is the maximum number of significant digits and hence the maximum length of the string returned. nsig must be either nil or a positive integer.


    (decimal-decode-float -12.34)"1234"; 2; -1
    (decimal-decode-float 1d-8)"1"; -7; 1
    (decimal-decode-float 6774.0 2)"68"; 4; 1
    (decimal-decode-float 9.999 2)"1"; 2; 1

This description is wrong as nsig rather is about rounding and nsig=0 also is a valid argument.