Re: float comparison?

2005-10-31 Thread Joerg Bruehe
Hi! Scott Gifford wrote: Jerry Swanson [EMAIL PROTECTED] writes: Why when I do select from database and try to compare float field with float number, I have no results amount --- type float select * from price where amount = 3.45 // doesn't work select * from price where amount = '3.45'

Re: float comparison?

2005-10-31 Thread Michael Stassen
Hassan Schroeder wrote: Scott Gifford wrote: select * from price where amount = 3.45 // doesn't work Floating point numbers are very rarely equal, because of small rounding errors that happen all the time. Probably the actual number in the database is something like

Re: float comparison?

2005-10-31 Thread Scott Gifford
Michael Stassen [EMAIL PROTECTED] writes: Scott Gifford wrote: [...] Try something like this: select * from price where amount 3.44 and amount = 3.46 I hope the = was a typo? Yes. Scott. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To

float comparison?

2005-10-29 Thread Jerry Swanson
Why when I do select from database and try to compare float field with float number, I have no results amount --- type float select * from price where amount = 3.45 // doesn't work select * from price where amount = '3.45' //doesn't work select * from price where amoun like '3.45' //work My

Re: float comparison?

2005-10-29 Thread Scott Gifford
Jerry Swanson [EMAIL PROTECTED] writes: Why when I do select from database and try to compare float field with float number, I have no results amount --- type float select * from price where amount = 3.45 // doesn't work select * from price where amount = '3.45' //doesn't work Floating

Re: float comparison?

2005-10-29 Thread Hassan Schroeder
Scott Gifford wrote: select * from price where amount = 3.45 // doesn't work Floating point numbers are very rarely equal, because of small rounding errors that happen all the time. Probably the actual number in the database is something like '3.44001'. Try something like