Renaud Diez wrote:
The following bug has been logged online:

Bug reference:      3959
Logged by:          Renaud Diez
Email address:      [EMAIL PROTECTED]
PostgreSQL version: 8.2
Operating system:   Debian
Description:        Huge calculation error
Details:
the basic mathematical expression like the following one doesn't compute the
correct result:

select 100*(1+(21/100));

return a result of 100 instead of 121.

It does compute the correct result, because you're doing integer calculations. 21/100 for integers is 0. To make it do float calc, you can do
select 100*(1+(21::float/100));

Or you can do
select 100*(1+(21.0/100));

which will force it to numeric.

//Magnus

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to