Re: Data Type precision - Mailing list pgsql-sql

From Karel Zak
Subject Re: Data Type precision
Date
Msg-id Pine.LNX.3.96.1000926095618.13691B-100000@ara.zf.jcu.cz
Whole thread Raw
In response to Data Type precision  (Jerome Raupach <jraupach@intelcom.fr>)
List pgsql-sql


/* ----------------* Karel Zak  *  zakkr@zf.jcu.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






pgsql-sql by date:

Previous
From: Jerome Raupach
Date:
Subject: Data Type precision
Next
From: "Edipo E. F. Melo"
Date:
Subject: date is not equals to dia/month/year: what's wrong?