OnLine 5.0 Problem With FLOATs
Posted in 1993
Topics: Installation, Setup & Upgrades, Third-Party Tools & Monitoring
WARNING!!! OnLine 5.0 Problem With FLOATs
After migrating some databases from SE to OnLine 5.0, we
discovered a problem with float values in our tables. I
wanted to warn others of the problem and inquire as to ways
that people may be working-around it.
Basically, when a float value is multiplied by another number
(integer or float?), the result is rounded to the nearest
integer.
For instance, with the following SQL (qty_per is FLOAT)...
select part_number, qty_per, qty_per * 1.00
from part_table
where qty_per > 0 and qty_per < 1
On our machine, where OnLine is now installed, we get...
part_number qty_per (expression)
...
part_1 0.46 0.00
part_2 0.62 1.00
...
On a different machine, where SE is still installed, we get...
part_number qty_per (expression)
...
part_1 0.46 0.46
part_2 0.62 0.62
...
Informix tells us that this is a known bug, corrected in 5.01.
That version is scheduled to be released in April.
The following work-arounds have been suggested:
1) Change float fields to decimal.
2) Change application code to manipulate float fields
within C data structures. I'm not sure why this might
work, and I have not confirmed that it would.
3) Multiply floats by 1.0000000001. This converts them
to decimals, which work fine.
4) Ask Informix for a beta copy of 5.01.
Has anyone else encountered this problem? Are there any other
suggestions?
Also, Informix, if you're out there... It really surprises me
that 5.0 could be released with such a serious defect. Do you
have any method of notifying customers about such problems?
It would have been nice if this was mentioned as part of the
4-day OnLine class that I attended and also communicated to
support customers.
Thanks,
Chris
--
Chris Mazzocco (chrism@sc.hp.com)
HEWLETT-PACKARD Santa Clara Site