Subject Re: 3 * 1/3 = 0 ???
Author rogervellacott
It gives you three decimal places (1+1+1), so the answer is 0.990,
which would make users think it was accurate, and even harder to
debug than 0.

--- In ib-support@y..., Ozan Suel <ozan@o...> wrote:
> 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@p...]
> Sent: Freitag, 30. August 2002 16:07
> To: ib-support@y...
> 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@e...
>
>
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>
> [Non-text portions of this message have been removed]