From: Vadim Nasardinov <vadimn@redhat.com>
To: pgsql-jdbc@postgresql.org
Subject: representing (seconds + microseconds) as floats [was:Re: Interval support for Postgres]
Date: Fri, 22 Apr 2005 09:56:17 -0400
Message-ID: <200504220956.17630@vadim.nasardinov> (raw)
In-Reply-To: <42681F57.4080308@opencloud.com>
References: <200504211107.01028.o.siegmar@vitrado.de>
<Pine.BSO.4.56.0504211551070.10463@leary.csoft.net>
<42681F57.4080308@opencloud.com>
On Thursday 21 April 2005 17:47, Oliver Jowett wrote:
> Kris Jurka wrote:
> > 1) You have an "int milliseconds" field. PG supports microsecond
> > precision in intervals. Is there any reason not to go with a
> > plain "float seconds" field instead of splitting these up?
>
> Can you represent all of 0.000000 .. 59.999999 exactly as floats?
Seem like you more or less can -- up to 16.000001:
| $ cat QuickTest.java
| public class QuickTest {
| public static void main(String[] _) {
| System.out.println("16.000001f - 16.000000f = " +
| (16.000001f - 16.000000f));
|
| System.out.println("16.000002f - 16.000001f = " +
| (16.000002f - 16.000001f));
| }
| }
|
| $ javac QuickTest.java
|
| $ java -cp . QuickTest
| 16.000001f - 16.000000f = 1.9073486E-6
| 16.000002f - 16.000001f = 0.0
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: vadimn@redhat.com
Subject: Re: representing (seconds + microseconds) as floats [was:Re: Interval support for Postgres]
In-Reply-To: <200504220956.17630@vadim.nasardinov>
References: <200504211107.01028.o.siegmar@vitrado.de> <Pine.BSO.4.56.0504211551070.10463@leary.csoft.net> <42681F57.4080308@opencloud.com> <200504220956.17630@vadim.nasardinov>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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