[Newbies] Re: Aw: Re: Float-Subclasses?
nicolas cellier
nicolas.cellier.aka.nice at gmail.com
Fri Jul 1 17:24:10 UTC 2011
<bblochl <at> arcor.de> writes:
>
> That was the mail where the Smalltalk brand came in, the name of I do not
want to repeat. Would have been better
> to bring in the "Draft American National Standard for Information Systems -
Programming Languages - Smalltalk?
>
> Thank you for all the many sympathic responds to my question, mostly correct.
I can not and will not respond
> to every single argument.
>
> There was a special reason for my question, namely this method -ther are many
others helpful for numeric
> "precise" calclatons:
>
> decimalDigits
> Return the number of decimal digits of precision for a FloatD.
Technically, if P is the precision for the
> representation, then the decimal precision Q is the maximum number of decimal
digits such that any
> floating point number with Q base 10 digits can be rounded to a floating point
number with P base 2 digits and
> back again, without change to the Q decimal digits.
>
> Please understand that I forgot where I found the definition.
>
> Anyway, thanks again. I do not longer want to waste your time and get off the
mail list - now.
>
> Cheers and have fun!
>
> B. B.
That's an interesting topic.
You must be aware that 4 years ago, most (all?) Smalltalk would have failed
to read the Float back whatever the number of digits used.
This is because Float was used in intermediate computations.
Thus several rounding errors did cumulate when converting back in base 2.
Currently, Squeak/Pharo/gst, have corrected this behavior.
Probably Dolphin and Smalltalk/X too.
Maybe the latest VWNC 7.8 too...
...but I can't test, the version is not easily available.
In Squeak, Float>>storeOn: outputs the shortest representation that will
convert back to same Float.
I think this behavior is superior to #decimalDigits
That's a feature I'd like to have by default and miss constantly in C, etc...
Pharo did also connect this behavior to Float>>printOn:, IMO a good idea.
Nicolas
More information about the Beginners
mailing list