Re: chop off non-meaningful digits

From: Berend Tober <btober(at)seaworthysys(dot)com>
To:
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: chop off non-meaningful digits
Date: 2006-11-14 13:22:12
Message-ID: 4559C304.1030905@seaworthysys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Owen 2006-11-14 13:31:18 Re: Out of memory (Failed on request size 24)
Previous Message jmv 2006-11-14 13:15:05 specified cluster does not exist error