in reply to Difference between inline SQL and bound data
What am I doing wrong here? A float is a float right? Why does it matter how I use it?
The difference seems to be at one point Perl converts the decimal representation to float, and in the other occasion it's the database. If their algorithms differ, and result in just one bit being set differently, it would explain what you observe.
The correct solution is not to compare floating point numbers for equality, but do a range comparison like WHERE ABS(latitude - ?) < 0.000001 AND ...
If you really want to look for exact floating point values, consider storing them as strings in the database, not as actual numbers (but that might be a bad idea, depending on what else you want to do with them).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Difference between inline SQL and bound data
by JavaFan (Canon) on May 16, 2010 at 20:34 UTC | |
by polettix (Vicar) on May 17, 2010 at 15:46 UTC | |
|
Re^2: Difference between inline SQL and bound data
by MattLG (Beadle) on May 16, 2010 at 17:55 UTC |