[Python-ideas] Python Numbers as Human Concept Decimal System
Ron Adam
ron3200 at gmail.com
Sat Mar 8 19:10:45 CET 2014
On 03/08/2014 11:43 AM, Chris Angelico wrote:
> On Sun, Mar 9, 2014 at 4:35 AM, Ron Adam<ron3200 at gmail.com> wrote:
>> >A repr should give the exact value its object if it's suppose to be a
>> >machine readable version of it. (As numbers __repr__ should do.)
> As I understand it, float.__repr__ does indeed give the exact value,
> in terms of reconstructing the float.
What I'm thinking about is...
If floats repr is changed to disregard exta digits, will this still be
true? How is float to know what exta digits should be disregarded?
> There are infinitely many float literals that will result in the exact
> same bit pattern, so any of them is valid for repr(n) to return.
When are float literals actually converted with floats. It seems to me,
that the decimal functions can be used to get the closest one. Then they
will be consistent with each other. (if that isn't already being done.)
Cheers,
Ron
More information about the Python-ideas
mailing list