[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exponential number



If format specifies a decimal fractional format, it does not seem reasonable
to "round" an arbitrary value to a integer precision. It however does seem
most reasonable to assume that fractional formatted values are rounded to
the precision specified by the format specification (wouldn't it?).

With respect to SRFI 48, it would seem that when no significant digits of
precision are representable within the format field specified, format should
return it's exponential representation to the precision specified.

Arguably, it's exponential representation should be returned as required
to provide at least N fractional significant digits of precision as
specified to the limit of the values representation precision (which is
implementation dependant); As otherwise what's the point of specifying a
value's formatted precision, if you don't care to know and rely on it's it's
value being represented that precision? Leading zero's generally aren't
considered significant if non-zero digit's of representation precision
remain.


> From: Ken Dickey <Ken.Dickey@xxxxxxxxxxxxxx>
> Organization: BitWize Consulting
> Date: Fri, 28 May 2004 05:33:57 -0700
> To: soo <tilde@xxxxxxxxxxx>
> Cc: srfi-48@xxxxxxxxxxxxxxxxx
> Subject: Re: exponential number
> Resent-From: srfi-48@xxxxxxxxxxxxxxxxx
> Resent-Date: Fri, 28 May 2004 14:34:18 +0200 (DFT)
> 
> On Friday 28 May 2004 04:06 am, soo wrote:
>>>> (format "~0,3F" 1.23e-20)
>>>> "0.000"
>>  |
>>  | Why do you think the above is a bug? What do you think is wrong?
>> 
>> I think that the above result should be "1.230e-20" in implementations that
>> 1.23e-20 is evaluated to 1.23e-20.  If an system evaluates 1.23e-20 to 0.0,
>> the above "0.000" is right.  The problem is that FORMAT coerces 1.23e-20 to
>> be evaluated to 0.0 with ROUND.
> 
> This is acceptable behavior.
> 
> To quote again from SRFI-48:
> "For very large or very small numbers, the point where exponential notation
> is used is implementation defined. "
> 
> You are certainly welcome to provide your own implementation.
> 
> Cheers,
> -KenD
> 
>