Re: Re: MySQL double

Sebastien Bigaret <[email protected]> 03 Feb 2004 19:38:57 +0100
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
Mario Ruggier <[email protected]> wrote:
[speaking of DOUBLE vs FLOAT in mysql, for floats like 1.24e-127]
> wouldn't this be an appropriate case for using FixedPoint? As per:
> <http://modeling.sourceforge.net/UserGuide/attribute-custom-type-
> example.html>
> Or are there other reasons, maybe performance?, for not doing so?

  Well, probably not in this case, or you'll need a precision of 129 to
represent 1.24e-127 correctly with FixedPoint ;) FixedPoint is really
fixed, relative to zero.

The problem here was just the range of valid values on mysql side: the
minimum acceptable value for a FLOAT is +/-1.1E-38, that's why 1e-127
was rounded to 0; but with DOUBLE the min. value is +/-1.8-308.
(http://www.mysql.com/doc/en/Column_types.html)

BTW and in relation to the topic, PEP 327: Decimal Data Type was
announced a few days ago, see at:
http://groups.google.com/groups?selm=mailman.1036.1075467073.12720.python-list%40python.org
 (seen on daily python today)


-- Sébastien.



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn