Re: chop off non-meaningful digits

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: "Berend Tober" <btober(at)seaworthysys(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: chop off non-meaningful digits
Date: 2006-11-14 14:06:36
Message-ID: 65937bea0611140606h34d79feela3e263d0f9e5b2a0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I just noticed this one:

postgres=# select 1000.000::float;
float8
--------
1000
(1 row)

postgres=# select 1000.0001::float;
float8
-----------
1000.0001
(1 row)

postgres=# select 1000.000100::float;
float8
-----------
1000.0001
(1 row)

postgres=#

HTH,

Best regards,

--
gurjeet[(dot)singh](at)EnterpriseDB(dot)com
singh(dot)gurjeet(at){ gmail | hotmail | yahoo }.com

On 11/14/06, Berend Tober <btober(at)seaworthysys(dot)com> wrote:
>
> A. Kretschmer wrote:
> > am Tue, dem 14.11.2006, um 0:58:56 -0500 mailte Tom Lane folgendes:
> >
> >> "SunWuKung" <Balazs(dot)Klein(at)t-online(dot)hu> writes:
> >>
> >>> Yep, I think this is it:
> >>> select trim(trailing '0.' from 1.020)
> >>>
> >> Um, I think not:
> >>
> >> regression=# select trim(trailing '0.' from 1000.000);
> >> rtrim
> >> -------
> >> 1
> >> (1 row)
> >>
> > For this case:
> >
> > test=*> select trim(trailing '.' from trim(trailing '0' from 1000.000));
> > rtrim
> > -------
> > 1000
> >
>
> Perhaps the OP doesn't really care about this, but FWIW one thing I
> recall from high school science (or maybe it was middle school), the
> zeros to the right of the decimal place ARE meaningful, i.e., 1000.000
> signifies something different than 1000, namely, a measurement three
> orders of magnitude more precise. So "chopping off non-meaningful
> digits" is something you ought to do only for zeros on the left.
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message matthew.d.williams@gmail.com 2006-11-14 14:08:44 Trouble migrating from PostgreSQL --> Oracle
Previous Message Markus Schiltknecht 2006-11-14 13:52:41 Re: Large Object to Bytea Conversion