pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John R Pierce <pierce@hogranch.com>
To: pgsql-bugs@postgresql.org
To: carlos_penteado@yahoo.com.br
Subject: Re: BUG #14026: Problem to convert number to real
Date: Thu, 17 Mar 2016 16:18:52 -0700
Message-ID: <56EB3B5C.3020809@hogranch.com> (raw)
In-Reply-To: <20160316200706.5227.26504@wrigleys.postgresql.org>
References: <20160316200706.5227.26504@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 3/16/2016 1:07 PM, carlos_penteado@yahoo.com.br wrote:
> SELECT 109048.96::float, 0.96::float
> RETURNS
> 109048.96;0.96
> but
> SELECT 109048.96::real, 0.96::real
> RETURNS
> 109049;0.96


float with unspecified precision is treated as double precision. real is 
by definition single precision, which is only accurate to around 6 digits.

see http://www.postgresql.org/docs/current/static/datatype-numeric.html



-- 
john r pierce, recycling bits in santa cruz



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)  latest in thread

Message-ID: <56EB3B5C.3020809@hogranch.com>
Permalink:  ../56EB3B5C.3020809@hogranch.com/
Also on:    postgresql.org/message-id/56EB3B5C.3020809@hogranch.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: pierce@hogranch.com, carlos_penteado@yahoo.com.br
  Subject: Re: BUG #14026: Problem to convert number to real
  In-Reply-To: <56EB3B5C.3020809@hogranch.com>
  References: <20160316200706.5227.26504@wrigleys.postgresql.org> <56EB3B5C.3020809@hogranch.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox