[squeak-dev] The Inbox: Kernel-nice.690.mcz
David T. Lewis
lewis at mail.msen.com
Sun May 20 17:20:13 UTC 2012
On Sun, May 20, 2012 at 05:42:04PM +0200, Bert Freudenberg wrote:
>
> On 20.05.2012, at 15:56, Nicolas Cellier wrote:
>
> > 2012/5/20 Bert Freudenberg <bert at freudenbergs.de>:
> >>
> >> 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 -
> >>
> >
> > That's why I prefer scheme 0.10000000000000000###, but since this is
> > not a valid literal syntax, I didn't dare...
> >
> > Nicolas
>
>
> David:
>
> Float pi printShowingDecimalPlaces: 30
> ==> '3.141592653589793115997963468544' (before)
> ==> '3.141592653589793000000000000000' (after)
>
> The latter seems way better to me.
>
+1
I'm fine with the change, I was just trying to think of some possible
objection so we could say we discussed it ;)
Dave
More information about the Squeak-dev
mailing list
|