/* ----------------
 * Karel Zak  *  [EMAIL PROTECTED]  *  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




Reply via email to