Hi, OK, I think you have convinced me to remove support for -0.0. If this is what other databases do, then it would improve compatibility, and wouldn't harm too much.
I will try to find more info about -0.0 in databases. A patch with simple test cases would be nice (maybe a simple SQL script with a few cases). I would like to test this with other databases as well. The question is, should this change be done in a minor version? I think yes, because the current behavior is unexpected for users, so it would be more like a bugfix than a change. Also, version 1.4.x is officially still beta, so this change is not in a stable version. Regards, Thomas On Tuesday, June 16, 2015, Christopher Deckers <[email protected]> wrote: > 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 [email protected] > <javascript:_e(%7B%7D,'cvml','h2-database%[email protected]');> > . > To post to this group, send email to [email protected] > <javascript:_e(%7B%7D,'cvml','[email protected]');>. > Visit this group at http://groups.google.com/group/h2-database. > For more options, visit https://groups.google.com/d/optout. > -- 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.
