Search Postgresql Archives

Re: Real type with zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29/06/2011 7:24 PM, Condor wrote:
Hello,
how I can tell my postgresql to store last zero of real type ? I put value 2.30 and when I select that column i see 2.3 without zero.

The real data type is an IEEE 754 floating point number. See:

http://en.wikipedia.org/wiki/Floating_point
http://steve.hollasch.net/cgindex/coding/ieeefloat.html

It doesn't store any information about formatting or layout. If you want to retain that information, you'll need to use NUMERIC or just store your numbers as formatted strings. Note that NUMERIC doesn't store error ranges and its formatting isn't preserved by most arithmetic operations; it's not a full scientific error-bounded numeric type.

regress=> SELECT '4401.00100'::numeric;
  numeric
------------
 4401.00100
(1 row)

regress=> SELECT '4401.00100'::float;
  float8
----------
 4401.001
(1 row)

--
Craig Ringer

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux