I think this is not a bug. 
abs(300 - 200)/200 is calculated as integer.
try:

gevik=# SELECT abs(300 - 200)/200::float*100 as bad, abs(300-200)*100/200 as
good;
 bad | good
-----+------
  50 |   50
(1 row)

------------------------------------------------
Gevik Babakhani

PostgreSQL NL       http://www.postgresql.nl
TrueSoftware BV     http://www.truesoftware.nl
------------------------------------------------
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Michailas
> Sent: Friday, November 30, 2007 10:18 AM
> To: pgsql-bugs@postgresql.org
> Subject: [BUGS] BUG #3791: Bug in aritmethic calculations
> 
> 
> The following bug has been logged online:
> 
> Bug reference:      3791
> Logged by:          Michailas
> Email address:      [EMAIL PROTECTED]
> PostgreSQL version: 8.2.4-2
> Operating system:   Debian
> Description:        Bug in aritmethic calculations
> Details: 
> 
> postgres=# SELECT abs(300 - 200)/200*100 as bad, 
> abs(300-200)*100/200 as good;
> 
>  bad | good
> -----+------
>    0 |   50
> (1 row)
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
> 


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to