Skip site navigation (1) Skip section navigation (2)

Re: BUG #3959: Huge calculation error

From: Rodriguez Fernando <rodriguez(at)ort(dot)edu(dot)uy>
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 15:02:34
Message-ID: 47B3068A.6000906@ort.edu.uy (view raw or flat)
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.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
>   
Hola, en realidad no lo hace mal, no es lo que esprabas, lo que en 
realidad necesitas es esto:
select 100*(1+(21.0/100))::float;
saludos Fernando

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2008-02-13 15:40:32
Subject: Re: BUG #3958: Self-Join Group-By Clause Produces Incorrect Results
Previous:From: Adam HardyDate: 2008-02-13 13:12:36
Subject: Re: BUG #3894: JDBC DatabaseMetaData.getTables is inconsistently case-sensitive with schema name

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group