This is complicated by single-flonums which seem to pretty out in the
reading format:

(number->string 3f0) ===> "3.0f0"

which is likely to look like an error to users.

This makes me feel like I should never use number->string to show
something to a user... which seems strange.

On Wed, Apr 20, 2016 at 1:28 PM, Jay McCarthy <jay.mccar...@gmail.com> wrote:
> The documentation for (number->string z radix) is a bit sparse:
> "Returns a string that is the printed form of z in the base specified
> by radix. If z is inexact, radix must be 10, otherwise the
> exn:fail:contract exception is raised."
>
> In the case that z is inexact, are we guaranteed that it will always
> print as "<Sign>?<Digit>+<Dot><Digit>+" and never use... (a) the
> #i<Digit>+ format, (b) scientific notation, (c) not have a leading 0,
> and so on?
>
> Essentially, I would like to know that (number->string z 10) on an
> inexact is equivalent to (real->decimal-string z +inf.0) (if infinity
> were a legal value for the length of the decimal.)
>
> If not, there doesn't seem to be another function that reliably prints
> out floats.
>
> Jay
>
> --
> Jay McCarthy
> Associate Professor
> PLT @ CS @ UMass Lowell
> http://jeapostrophe.github.io
>
>            "Wherefore, be not weary in well-doing,
>       for ye are laying the foundation of a great work.
> And out of small things proceedeth that which is great."
>                           - D&C 64:33



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

           "Wherefore, be not weary in well-doing,
      for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
                          - D&C 64:33

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to