Home > Archive > PostgreSQL JDBC > April 2005 > representing (seconds + microseconds) as floats [was:Re: Interval support for Postgres]









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2005-04-22, 9:24 am

On Thursday 21 April 2005 17:47, Oliver Jowett wrote:
> Kris Jurka wrote:
>
> 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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com