pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Data Type precision
3+ messages / 3 participants
[nested] [flat]

* Data Type precision
@ 2000-09-26 07:44  Jerome Raupach <jraupach@intelcom.fr>
  0 siblings, 2 replies; 3+ messages in thread

From: Jerome Raupach @ 2000-09-26 07:44 UTC (permalink / raw)
  To: pgsql-sql

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)


anybody can help me ?
Thanks. Jerome.



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Data Type precision
@ 2000-09-26 08:02  Karel Zak <zakkr@zf.jcu.cz>
  parent: Jerome Raupach <jraupach@intelcom.fr>
  1 sibling, 0 replies; 3+ messages in thread

From: Karel Zak @ 2000-09-26 08:02 UTC (permalink / raw)
  To: Jerome Raupach <jraupach@intelcom.fr>; +Cc: 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







^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Data Type precision
@ 2000-09-26 17:41  Jie Liang <jliang@ipinc.com>
  parent: Jerome Raupach <jraupach@intelcom.fr>
  1 sibling, 0 replies; 3+ messages in thread

From: Jie Liang @ 2000-09-26 17:41 UTC (permalink / raw)
  To: Jerome Raupach <jraupach@intelcom.fr>; +Cc: pgsql-sql

Hi, there,

You can use function:

urldb=# select round(234.356534,2);
 round
--------
 234.36
(1 row)


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)
>
> anybody can help me ?
> Thanks. Jerome.

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2000-09-26 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-09-26 07:44 Data Type precision Jerome Raupach <jraupach@intelcom.fr>
2000-09-26 08:02 ` Karel Zak <zakkr@zf.jcu.cz>
2000-09-26 17:41 ` Jie Liang <jliang@ipinc.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox