Re: BUG #3959: Huge calculation error - Mailing list pgsql-bugs

From Heikki Linnakangas
Subject Re: BUG #3959: Huge calculation error
Date
Msg-id 47B2D381.1010304@enterprisedb.com
Whole thread Raw
In response to BUG #3959: Huge calculation error  ("Renaud Diez" <rdiez@salesprize.com>)
List pgsql-bugs
Renaud Diez wrote:
> The following bug has been logged online:
>
> Bug reference:      3959
> Logged by:          Renaud Diez
> Email address:      rdiez@salesprize.com
> 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.

That's because 21/100 = 0, in integer math. Try "SELECT
100*(1+(21/100.0))" to use floating points.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-bugs by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: BUG #3959: Huge calculation error
Next
From: Adam Hardy
Date:
Subject: Re: BUG #3894: JDBC DatabaseMetaData.getTables is inconsistently case-sensitive with schema name