round returns -0

From: Tony Dare <wadedare4703(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: round returns -0
Date: 2013-03-07 02:42:37
Message-ID: 5137FE9D.3070200@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm taking an standard deviation of a population and subtracting it from
the average of the same population and rounding the result. Sometimes
that result is negative and rounding it returns (or shows up as) a
negative zero (-0) in a SELECT.

basically:
SELECT
client_name, avg(rpt_cnt),
stddev_pop(rpt_cnt),
round(avg(rpt_cnt) - stddev_pop(rpt_cnt))
from client_counts
group by client_name

and what I sometimes get is :
client_name | a dp number | a dp number | -0

In postgresql-world, is -0 = 0? Can I use that negative 0 in further
calculations without fear? Is this a bug?

pg version is 9.2
OS is Windows 2003.

Thanks,

Wade Dare
"Committed to striving for an effort to try..."

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ian Pilcher 2013-03-07 03:16:19 Trust intermediate CA for client certificates
Previous Message Ian Lawrence Barwick 2013-03-07 01:15:42 Re: ERROR: syntax error at or near ":"