[squeak-dev] The Inbox: Kernel-nice.690.mcz

Bert Freudenberg bert at freudenbergs.de
Sun May 20 13:07:39 UTC 2012


On 20.05.2012, at 14:54, David T. Lewis wrote:

> Regarding this change:
> 
>>> 2) Don't print arbitrary digits beyond Float precision, just print zeros
>>> (0.1 printShowingDecimalPlaces: 20) now prints '0.10000000000000000000'
>>> instead of '0.10000000000000000555',
>>> Rationale: those digits, while reflecting internal representation exactly,
>>> are totally insignificant and could be replaced with any other digits, while still representing the same Float.
> 
> The rationale is correct, although a contrary argument might be that
> the trailing '555' digits provide a visual cue as to floating point
> precision. The visual reminder may be useful when mixing single and
> double precision floats.
> 
>  (FloatArray with: 0.1) first printShowingDecimalPlaces: 20
>    ==> '0.10000000149011611938'
> 
>  0.1 asFloat printShowingDecimalPlaces: 20
>    ==> '0.10000000000000000555'
> 
> Dave


But 

	0.10000000000000000555 = 0.10000000000000000000

What do you gain by showing the byproducts of the printing algorithm, which have nothing to do with the actual number?

- Bert -




More information about the Squeak-dev mailing list