Re: Unexpected result using floor() function

From: Pujol Mathieu <mathieu(dot)pujol(at)realfusio(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Unexpected result using floor() function
Date: 2016-03-14 16:54:11
Message-ID: 56E6ECB3.5010405@realfusio.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le 14/03/2016 15:29, Merlin Moncure a écrit :
> On Mon, Mar 14, 2016 at 9:21 AM, Pujol Mathieu
> <mathieu(dot)pujol(at)realfusio(dot)com> wrote:
>> Hi
>> I reproduce your bug using "PostgreSQL 9.3.6, compiled by Visual C++ build
>> 1600, 64-bit" on Windows 8
>> I also notice that SELECT floor(4.725 * power(10, 2)::numeric + 0.5) work as
>> expected
> I don't think this is a bug -- just peculiarities of floating point math.
>
> merlin
>
>
I think also that it is a float precision issue but the weird thing is
that both calls without floor return 273. Maybe the display method make
a rounding ?

SELECT 4.725 * power(10, 2)::numeric + 0.5) => 273.000
SELECT (4.725 * power(10, 2) + 0.5) => 273

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2016-03-14 16:54:44 Re: enum bug
Previous Message Andrew Sullivan 2016-03-14 16:43:43 Re: enum bug