BUG #4653: zero with negative sign returned on round(sin) function - Mailing list pgsql-bugs

From Marco Vieira
Subject BUG #4653: zero with negative sign returned on round(sin) function
Date
Msg-id 200902132158.n1DLw00Z052532@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4653: zero with negative sign returned on round(sin) function  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4653
Logged by:          Marco Vieira
Email address:      maovieira@gmail.com
PostgreSQL version: 8.3.5
Operating system:   x86_64-pc-linux-gnu (ubuntu 4.3.2-1ubuntu11 )
Description:        zero with negative sign returned on round(sin) function
Details:

If I query select round(sin(2.0*pi()*0.51)) I get "-0" as return but zero is
unsigned.

but: select sin(2.0*pi()*0.51)
returns: -0.0627905195293133
and select round(-0.0627905195293133)
returns: 0 (no sign)

I used cast to work around it: select round(sin(2.0*pi()*0.51))::int

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: 8.3.5: Query Planner takes 15+ seconds to plan Update or Delete queries on partitioned tables.
Next
From: Tom Lane
Date:
Subject: Re: BUG #4653: zero with negative sign returned on round(sin) function