Re: BUG #3959: Huge calculation error

From: "Heikki Linnakangas" <heikki(at)enterprisedb(dot)com>
To: "Renaud Diez" <rdiez(at)salesprize(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #3959: Huge calculation error
Date: 2008-02-13 11:24:49
Message-ID: 47B2D381.1010304@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Renaud Diez wrote:
> The following bug has been logged online:
>
> Bug reference: 3959
> Logged by: Renaud Diez
> Email address: rdiez(at)salesprize(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Adam Hardy 2008-02-13 13:12:36 Re: BUG #3894: JDBC DatabaseMetaData.getTables is inconsistently case-sensitive with schema name
Previous Message Magnus Hagander 2008-02-13 11:24:13 Re: BUG #3959: Huge calculation error