Hi Thomas,
 

> I think we have two options: support -0.0 (as we do now), or completely 
> remove support for it. I don't see a way that we can support it on some 
> places, but not support it in other places.
>

Fair enough, but then -0.0 should not be supported. 
 

> It looks like this is what other databases do. But I'm not a fan of that.
>

There are good reasons other databases decided to remove it. The point of 
storing numeric types is to be able to perform computations on them, which 
is very hard with H2's DOUBLE type.
Say you do "ColumnX * ColumnY < 0", and this sometimes yields true for 
simple columns like (0 * -1). Say you divide by a value using CASE WHEN to 
make sure value <> 0, this would fail for -0.0. You cannot prevent -0.0 
from happening and it is very hard to handle. No one expects this.
 

> I tend to think that the current solution, which is to support -0.0, is 
> fine.
>

Most developers don't know or care that -0.0 exists in Java, because it 
behaves like 0.0. Those developers then use H2 and their computations fail. 
They have to understand that H2 has a unique way of handling -0.0 and 
clutter all their statements with additional checks, impacting performance 
too, for something that was never a problem in Java. As I said, the only 
reason for -0.0 to exist is to yield -infinity on specific occasions and 
eventually convey the intent that a value approximates 0 from the negative 
side.

At least, would it be possible to make an option to activate a mode where 
DOUBLE, FLOAT, FLOAT8, REAL and FLOAT4 behave like in Java, (either 
removing -0.0 or handle it so that it behaves like 0.0)? Note that if such 
option existed, it should be the default to comply with the principle of 
least astonishment.

Cheers,
-Christopher

-- 
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
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