From: | Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> |
---|---|
To: | Jerome Raupach <jraupach(at)intelcom(dot)fr> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Data Type precision |
Date: | 2000-09-26 08:02:38 |
Message-ID: | Pine.LNX.3.96.1000926095618.13691B-100000@ara.zf.jcu.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
/* ----------------
* Karel Zak * zakkr(at)zf(dot)jcu(dot)cz * http://home.zf.jcu.cz/~zakkr/
* C, PostgreSQL, PHP, WWW, http://docs.linux.cz
* ----------------
*/
On Tue, 26 Sep 2000, Jerome Raupach wrote:
> CREATE TABLE TR (f1 FLOAT4, f2 INT4, f3 INT4) ;
>
> UPDATE TR SET f1=f2/f3::FLOAT4 ;
>
> f1 -> xxxxxx,xxxxxx - but I want f1 -> xxxxxx,xx.
> (6,6) (6,2)
See formatting functions in docs:
test=# SELECT TO_CHAR( 123456.123456, '999999.99')::float8;
?column?
-----------
123456.12
(1 row)
Note, really float4 with 8 places (6,2)?
test=# select '123456.12'::float4;
?column?
----------
123456
(1 row)
test=# select '1234.12'::float4;
?column?
----------
1234.12
(1 row)
test=# select '123456.12'::float8;
?column?
-----------
123456.12
(1 row)
Karel
From | Date | Subject | |
---|---|---|---|
Next Message | Danny | 2000-09-26 12:06:52 | Re: Re: [HACKERS] RFC - change of behaviour of pg_get_userbyid & pg_get_viewdef? |
Previous Message | Jerome Raupach | 2000-09-26 07:44:21 | Data Type precision |