Problem with floats from Oracle

Problem with floats from Oracle

Post by » Sat, 14 Feb 2004 00:00:59

Hi all!

I have a with D5 on an Oracle database (8.1.5) where it does not
return the data I need.

I read some information from a table, in order to pick an 140 rows old
row (using rowcounrt). This works fine. I get a float (for DateTime,
as Orcale cannot handle MilliSeconds).

Later I try to read data using the number I obtained, in e.g.

where RECORD_TIME>=38022.67632461809920

The number comes from Str(val:0:15).

The problem is, that when browsing the database, it does not return
rows where record_time is 38022.6763246181 - it is higher, and even
when rounding, it should still be equal.

Anyone know about this?


Problem with floats from Oracle

Post by Jami » Sat, 14 Feb 2004 05:32:53

it depends in what mode the FPU is in .
in the Math Unit there is a couple of
functions for contronlling the FPU controlword.
i don't remember what they are. something like
SetControlWord and GetControlWord or something of that
anways you can control how the FPU treats the numbers.


Problem with floats from Oracle

Post by » Tue, 17 Feb 2004 17:22:50

The problems goes deeper than that...

I read a value out of the DB (38022.67632461809920), which I later use
for a select

WHERE RECORD_TIME >= 38022.67632461809920

Looking at the table with any DB browser (such as TOAD), I see that it
is 38022.6763246181, but when selecting it later, it does not find
this row.
Using 38022.6763246180 works, as well as 38022.67632461804454

It rounds somehow, just I dont know what is going on....

Problem with floats from Oracle

Post by Jose Pere » Wed, 18 Feb 2004 04:48:33

I would guess that your problem may be occurring because of the size of the
variable type that you are using. 38022.6763246180 is 15 digits. I don't
have any documentation close by, but that sounds like the limit for one of
the float types. Try another type.