Re: Division in Postgre

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: tuan <atuan_h(at)hotmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Division in Postgre
Date: 2005-04-30 03:56:05
Message-ID: 20050429205407.B60676@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-04-30 04:38:36 Re: Build issues: "-static" builds resulting initdb problems
Previous Message Stephan Szabo 2005-04-30 03:51:37 Re: Question about update syntaxt