Re: Python, mysql, floating point values question

2005-07-03 Thread Andy Dustman
Use DECIMAL columns with MySQLdb-1.2.0 and Python-2.4 and you should get values back using Python's new decimal type. http://docs.python.org/whatsnew/node9.html This avoids floating point inaccuracies. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, mysql, floating point values question

2005-07-03 Thread beliavsky
Dennis Lee Bieber wrote: > Considering how often this has come up, I've sort of lost faith > in CS programs at colleges. Now, this might be an unfair statement as I > don't know if any of those bringing up the question ever had college CS > courses... But the fluff of floating point data was

Re: Python, mysql, floating point values question

2005-07-02 Thread Terry Hancock
On Saturday 02 July 2005 10:50 pm, Peter Hansen wrote: > Terry Hancock wrote: > > On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote: > > And for that matter, some of the posters here have *been* 14. > > Terry, almost every single one of the posters here have been 14. > At some time. :-) U

Re: Python, mysql, floating point values question

2005-07-02 Thread Peter Hansen
Terry Hancock wrote: > On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote: > And for that matter, some of the posters here have *been* 14. Terry, almost every single one of the posters here have been 14. At some time. :-) -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, mysql, floating point values question

2005-07-02 Thread Terry Hancock
On Saturday 02 July 2005 08:53 pm, Dennis Lee Bieber wrote: > On Sat, 2 Jul 2005 18:49:20 -0400, Christopher Kang > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > I've been doing the epsilon comparisons, i had just hoped that to be a > > temporary solution. > > > Consid

Re: Python, mysql, floating point values question

2005-07-02 Thread Christopher Kang
Thanx all for responding. I've been doing the epsilon comparisons, i had just hoped that to be a temporary solution. anyway, thanx for the responses -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, mysql, floating point values question

2005-07-02 Thread Terry Hancock
On Friday 01 July 2005 11:13 pm, John Machin wrote: > x BETWEEN y AND z Ah, even better, thank you. >The python equivalent would be to write it out as: > > > > if a > b-epsilon and a < b+epsilon: > > print "a~=b" > > Try this: > > if b-epsilon < a < b+epsilon: This I knew, but I

Re: Python, mysql, floating point values question

2005-07-02 Thread qwweeeit
Hi Christopher, if you have to make calculations or comparing operations, the only "safe" method is to save and use only integer values. Of course there must be a preventive agreement on the precision you want to have (2, 3 4 ... decimals). The sw part is straigthforward: - to save in the database

Re: Python, mysql, floating point values question

2005-07-01 Thread John Machin
Terry Hancock wrote: > On Friday 01 July 2005 05:40 pm, Christopher Kang wrote: > >>Anyway, I have a problem where I am pulling floating point values out >>of mysql and into python using the MYSQLdb module. >> >>However, the values seem to be altered a little when I store them in python. > > > I

Re: Python, mysql, floating point values question

2005-07-01 Thread Terry Hancock
On Friday 01 July 2005 05:40 pm, Christopher Kang wrote: > Anyway, I have a problem where I am pulling floating point values out > of mysql and into python using the MYSQLdb module. > > However, the values seem to be altered a little when I store them in python. I'm not even going to start to exp

Re: Python, mysql, floating point values question

2005-07-01 Thread [EMAIL PROTECTED]
Christopher Kang wrote: > I had a question about python and mysql, but I want to first thank > those who taught me about the factory method, it was exactly what I > needed. > > Anyway, I have a problem where I am pulling floating point values out > of mysql and into python using the MYSQLdb modul