Re: [GENERAL] chop off non-meaningful digits

2006-11-14 Thread Berend Tober
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 ---

Re: [GENERAL] chop off non-meaningful digits

2006-11-14 Thread Gurjeet Singh
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 PROTECTED]

[GENERAL] chop off non-meaningful digits

2006-11-13 Thread SunWuKung
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

Re: [GENERAL] chop off non-meaningful digits

2006-11-13 Thread Raymond O'Donnell
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.

Re: [GENERAL] chop off non-meaningful digits

2006-11-13 Thread Shoaib Mir
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

Re: [GENERAL] chop off non-meaningful digits

2006-11-13 Thread A. Kretschmer
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 1.020 +

Re: [GENERAL] chop off non-meaningful digits

2006-11-13 Thread SunWuKung
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?

Re: [GENERAL] chop off non-meaningful digits

2006-11-13 Thread Tom Lane
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

Re: [GENERAL] chop off non-meaningful digits

2006-11-13 Thread A. Kretschmer
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) ;-) For this