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