Re: BUG #1179: Time comparison fail

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Mauricio CASTRO <mcastroe(at)hotmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1179: Time comparison fail
Date: 2004-06-22 22:23:10
Message-ID: 20040622145847.R27122@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 22 Jun 2004, Mauricio CASTRO wrote:

> You are right!
>
> I am doing something wrong? I understand that there is a difference but I
> don't know why.

Floating point math is inexact. The date_part(...) is returning a value
that is very close to, but not exactly 4.031 due to accuracy limitations.
So, when you multiply it by 1000 you can get a value very close to, but
not exactly 4031. When it tries to compare it to the bigint 4031, it
converts the bigint to a double as well and gets a different double from
the first.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Kris Jurka 2004-06-22 22:36:23 Re: BUG #1177: JDBC driver doesn't handle all dates correctly
Previous Message Mauricio CASTRO 2004-06-22 21:54:35 Re: BUG #1179: Time comparison fail