Hi,

ABS(0.0) is negative zero.
>

I think this is a bug, I will fix it.

-0.0 is allowed and not turned into 0.0.
>

Yes, this is how Java behaves.


> -0.0 is not zero.
>

This is somewhat unexpected, but I think it is reasonable. H2 uses
Double.compare(x, y), which first checks the sign.

ABS(-0.0) is zero.
>

I think that's expected.


> To test zero, we have to test (x = ZERO() OR ABS(x) = ZERO()).
>

If the above bug is fixed, you could just use ABS(x) = ZERO().

We push DOUBLE data programmatically to an H2 database
>

I suggest to not store -0.0.


> The ABS function turning zeros to negative zeros creates all sorts of
> wrong behaviors.
>

Yes, I agree, I will fix this.


> Moreover, I don't think that pushing a negative zero is legitimate from an
> SQL point of view (SQL Server used to have this issue which they fixed
> IIRC), and negative zeros should be saved as normal zeros.
>

I think because Java supports -0.0, H2 should also support it. I will keep
this behavior for now.

Regards,
Thomas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to