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

* Division in Postgre
@ 2005-04-24 09:18  tuan <atuan_h@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: tuan @ 2005-04-24 09:18 UTC (permalink / raw)
  To: pgsql-sql

In sql server my division select cast(3 as float)/10 is 0.29999999999.
But in postgres select cast(3 as float8)/10 is 0.3. How to get result like
sql server?
Thank you. Sorry for my english



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

* Re: Division in Postgre
@ 2005-04-30 03:56  Stephan Szabo <sszabo@megazone.bigpanda.com>
  parent: tuan <atuan_h@hotmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Stephan Szabo @ 2005-04-30 03:56 UTC (permalink / raw)
  To: tuan <atuan_h@hotmail.com>; +Cc: pgsql-sql

On Sun, 24 Apr 2005, tuan wrote:

> In sql server my division select cast(3 as float)/10 is 0.29999999999.
> But in postgres select cast(3 as float8)/10 is 0.3. How to get result like
> sql server?

I believe you can control what precision is used in printing the float
results with extra_float_digits. I believe setting it to 2 will give a
0.29... result however it has more 9s than the above.




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

* Re: Division in Postgre
@ 2005-05-02 04:15  hatuan <hatuan05@gmail.com>
  parent: Stephan Szabo <sszabo@megazone.bigpanda.com>
  0 siblings, 0 replies; 3+ messages in thread

From: hatuan @ 2005-05-02 04:15 UTC (permalink / raw)
  To: pgsql-sql

Thank you
----- Original Message -----
From: "Stephan Szabo" <sszabo@megazone.bigpanda.com>
To: "tuan" <atuan_h@hotmail.com>
Cc: <pgsql-sql@postgresql.org>
Sent: Saturday, April 30, 2005 10:56 AM
Subject: Re: [SQL] Division in Postgre


> On Sun, 24 Apr 2005, tuan wrote:
>
> > In sql server my division select cast(3 as float)/10 is 0.29999999999.
> > But in postgres select cast(3 as float8)/10 is 0.3. How to get result
like
> > sql server?
>
> I believe you can control what precision is used in printing the float
> results with extra_float_digits. I believe setting it to 2 will give a
> 0.29... result however it has more 9s than the above.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly




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


end of thread, other threads:[~2005-05-02 04:15 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-04-24 09:18 Division in Postgre tuan <atuan_h@hotmail.com>
2005-04-30 03:56 ` Stephan Szabo <sszabo@megazone.bigpanda.com>
2005-05-02 04:15   ` hatuan <hatuan05@gmail.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