[racket] ~r: formatting 0.0 with 'exponential and #:precision

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Wed May 8 12:54:10 EDT 2013

On 05/07/2013 01:12 PM, Dmitry Pavlov wrote:
> Hello,
>
> I just came across the following oddness with formatting
> of real numbers:
>
>  > (~r 1.0 #:notation 'exponential #:precision '(= 4))
> "1.0000e+00"
>
> OK
>
>
>  > (~r 0.0 #:notation 'exponential #:precision '(= 4))
> "0.e+04"
>
> ???
>
> Is there a rational explanation of why did
> the requested precision go into the exponent
> number for 0.0?

Nope, just a bug. It turns out zero is special. Thanks for the report!

Ryan


Posted on the users mailing list.