From: | Herouth Maoz <herouth(at)oumail(dot)openu(dot)ac(dot)il> |
---|---|
To: | Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it>, pgsql-general(at)postgreSQL(dot)org |
Subject: | Re: [GENERAL] decimal_part() function |
Date: | 1998-12-15 16:42:22 |
Message-ID: | l03110714b29c3ffd2fee@[147.233.159.109] |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
At 17:46 +0200 on 15/12/98, Sferacarta Software wrote:
> I'm looking for a function similar to dtrunc() to return the decimal
> part of a float.
>
> dtrunc(12.34) returns 12, I need something that returns 34
Here is a table having one float column named k. % is the truncation
operator (I suppose it's the same as dtrunc). so... k - %k gives you only
the fraction:
testing=> select k, %k, k - %k from test1;
k|?column?| ?column?
-----+--------+------------------
1.8| 1| 0.8
3.78| 3| 0.78
0.4| 0| 0.4
1.8| 1| 0.8
0.4| 0| 0.4
9.24| 9| 0.24
6| 6| 0
9.24| 9| 0.24
1.1| 1| 0.1
-1.8| -1| -0.8
-10.2| -10|-0.199999999999999
(11 rows)
If that's what you expect in the negative numbers, you're home free. If
not, you can use some other operator combination.
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
From | Date | Subject | |
---|---|---|---|
Next Message | dustin sallings | 1998-12-16 03:00:28 | Re: [GENERAL] Row Level Locking, On-line Recovery |
Previous Message | Sferacarta Software | 1998-12-15 15:46:06 | decimal_part() function |