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,-- [EMAIL PROTECTED][EMAIL PR
A. Kretschmer wrote:
am Tue, dem 14.11.2006, um 0:58:56 -0500 mailte Tom Lane folgendes:
"SunWuKung" <[EMAIL PROTECTED]> 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
am Tue, dem 14.11.2006, um 0:58:56 -0500 mailte Tom Lane folgendes:
> "SunWuKung" <[EMAIL PROTECTED]> 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)
"SunWuKung" <[EMAIL PROTECTED]> 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)
regards, tom lane
---(end of broadcast)-
Yep, I think this is it:
select trim(trailing '0.' from 1.020)
Many thanks.
SWK
"A. Kretschmer" wrote:
> am Mon, dem 13.11.2006, um 5:45:44 -0800 mailte SunWuKung folgendes:
> > What would be the easiest way to get back only the meaningful digits of
> > a numeric value in a pgsql function? eg?
am Mon, dem 13.11.2006, um 5:45:44 -0800 mailte SunWuKung folgendes:
> What would be the easiest way to get back only the meaningful digits of
> a numeric value in a pgsql function? eg?
>
> 1.002 --> 1.002
> 1.020 --> 1.02
> 1.200 --> 1.2
> 1.000 --> 1
You can use trim for this:
test=*> select
ROUND function might help you there:select round(1.2000::numeric, 1);Regards,Shoaib MirEnterpriseDB (www.enterprisedb.com)
On 13 Nov 2006 05:45:44 -0800, SunWuKung <[EMAIL PROTECTED]> wrote:
What would be the easiest way to get back only the meaningful digits ofa numeric value in a pgsql fu
On 13 Nov 2006 at 5:45, SunWuKung wrote:
> What would be the easiest way to get back only the meaningful digits of
> a numeric value in a pgsql function? eg?
There are various rounding functions built in... have a look at
http://www.postgresql.org/docs/8.1/static/functions-math.html
--Ray.
--
What would be the easiest way to get back only the meaningful digits of
a numeric value in a pgsql function? eg?
1.002 --> 1.002
1.020 --> 1.02
1.200 --> 1.2
1.000 --> 1
Thanks
SWK
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster