Possible float / numerical bug
Thorsten Hohage
thohage at genericobjects.de
Thu Jun 11 04:49:26 CDT 2009
Hi,
On 2009-06-11, at 10:29, Antuan Johnson wrote:
> lets say you set up a table lets call it TableA
>
> lets create two fields
>
> NumberA - Long Long (Type) (0)
> NumberB - Float (Type) (0.00000)
>
> Lets give NumberA (through the editor) a value of 100
> and NumberB a vaule of 0.50 or as it shows in the editor 0.50000
>
> now lets perform a query to multiply the two to demonstrate what
> happens:
>
>
> Update TableA Set NumberA= NumberA * NumberB
so multiplying a long long and a float results in ... float! Because
0.55 * 10 should always be 5.5
So even when you expect the result to be an integer, this is not
obvious for the db
when using the ceil - function you're going to tell the db, that you
only want to have integers
update floatIssue set fieldLong = ceil(fieldLong * fieldFloat)
For me this works on 4.2 b x
regards,
Thorsten Hohage
--
Valentina Technology Evangelist
generic objects GmbH - Leiter Solution Center Nord
More information about the Valentina
mailing list