Subject RE: [ib-support] 3 * 1/3 = 0 ???
Author Ozan Suel
Hi!

If You try

(1.0/3.0)*3.0

will You have the same result?

Greetings,
Ozan Suel
IXOS Software AG


-----Original Message-----
From: rogervellacott [mailto:rvellacott@...]
Sent: Freitag, 30. August 2002 16:07
To: ib-support@yahoogroups.com
Subject: [ib-support] 3 * 1/3 = 0 ???


I always thought this was true

(1/3)*3 = 1

But Interbase and Firebird (and probably all the other RDBMSs) say
this equals 0.

Try

SELECT (1/3)*3 FROM RDB$DATABASE

I know there was some discussion of this on this group some time ago,
and no doubt some convincing explanations were given, but I am a
simple soul, and the more I try to cope with it, the more obviously
wrong it is.

Did you know that

1/3.00 = 0.33
and
1.00/3 = 0.33

You might think this was a useful way of rounding. But no,
3.333333/1.00 = 3.33333300
so unless you have already determined how many decimal places there
are in every element of your formula, you cannot know how many
decimal places there will be in the answer.

In my view, this behaviour invites errors. Not only is it
unintuitive, it gives the wrong answers to simple calculations, and
unpredictable answers to complex calculations, and that is not a good
idea.

Any chance of changing it next version? If integer operations are
desired, how about a div? Please don't tell me that current
behaviour is good. It isn't.


Yahoo! Groups Sponsor
ADVERTISEMENT



To unsubscribe from this group, send an email to:
ib-support-unsubscribe@egroups.com



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



[Non-text portions of this message have been removed]