representing (seconds + microseconds) as floats [was:Re: Interval support for Postgres]

Поиск
Список
Период
Сортировка
От Vadim Nasardinov
Тема representing (seconds + microseconds) as floats [was:Re: Interval support for Postgres]
Дата
Msg-id 200504220956.17630@vadim.nasardinov
обсуждение исходный текст
Ответ на Re: Interval support for Postgres  (Oliver Jowett <oliver@opencloud.com>)
Список pgsql-jdbc
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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Palle Girgensohn
Дата:
Сообщение: BUG? res.next() == false, but psql finds tuples?
Следующее
От: Dave Cramer
Дата:
Сообщение: Re: BUG? res.next() == false, but psql finds tuples?