|Subject||Re: 3 * 1/3 = 0 ???|
> I always thought this was true... etc.
> (1/3)*3 = 1
> But Interbase and Firebird (and probably all the other RDBMSs) say
> this equals 0.
Regarding Dialect 3 treating integer results < 1 as zero, here is
message 12832 verbatim which explains why. You may care to follow
that earlier, lengthy, '$5 calculator' thread
thereabouts to save rehashing it now.
Note that when Helen is conspicuously absent from a busy thread
there is good reason, e.g. 1) it has been flogged to death in earlier
posts; or 2) it's all there if one cared to RTFM; or 3) ignorance
leads to frustration, frustration leads to anger, angry people form
mobs, mobs go on witch hunts, and ... well, it just so happens that
Helen owns a pointy hat. However, in this instance I believe the
correct answer is item 1.
<GGZZZZTT, cloaking device reactivated>
From: "csswa" <csswa@y...>
Date: Fri May 31, 2002 11:55 am
Subject: divisions - final final, really really!
'One L' gets the final word, and as usual she brings a state of zen-
like calm to this crazy, mixed-up world.
It's not a bug but the result of purer mathematical implementation.
BTW, having no further need for my $5 calculator, it now returns to
the back of the drawer. In fact I owe IBPhoenix $5. :-)
-- We've got what it takes to take what you've got.
>Why the behaviour difference between dialects???Because of the difference in the treatment and storage of numbers.
D.3 regards all numbers as expressible as 64-bit integer, D.1 as 32-
bit (like MSSQL and Oracle).
Because of this, new rules apply...
In D.3 (and, I think, in D.1 columns which were created on ODS10, not
certain about that though) the result of a division between two
integers is an integer. (There is actually a mathematical
justification for this which I *think* was explained by
Claudio during the "Klapperich bug" episode). In contrast, the
result of such a division in D.1 and lower IB's (and also MSSQL and
Oracle and probably PG as well, which don't have true 64-bit integer
support) results in a single or a double, depending on the scale of
the integers involved.