[Follow up with Sebastian]
Well good point and frankly I do not know :)
1. do we support float and double for @Min / @Max?
2. if 1 is yes, I'd be inclined to say the value should be double but
that's not fully automatic.
PS: I don't think the issue is addressable per se, it has to be
understood by users.
On Feb 27, 2009, at 16:54, Sebastian Thomschke wrote:
You have the same problem when the max value is a long:
System.out.println(0.99999999999999997d < 1L);
So one part is the question do we support the @Max for float and
properties? And if so how do we address this issue?
Emmanuel Bernard wrote:
> Not sure what the correct word is, might be fractional part vs
> We are doing comparison so
> say @Max(2.3d) applied on 2.2999999999999997d
> Also I am comparing a long with it's double equivalent
> System.out.println(2.2999999999999997d < 2.3d);
> System.out.println(new BigDecimal(""+2.2999999999999997d).compareTo(
> new BigDecimal(""+2.3d) ) == -1);
> System.out.println( new
> BigDecimal(9223372036854775807d)) == 0 );
> Not a pleasant surprise
> On Feb 27, 2009, at 17:20, Sebastian Thomschke wrote:
>> Yepp, I am aware of these rounding errors, however I think this is
>> mainly a problem if you are doing float/double based mathematical
>> operations. We are "only" using the value as a reference.
>> The alternative would be to have a separate long/int attribute to
>> specify the value after the decimal point (what's the correct
>> Engl. word
>> for this btw.?).
>> Emmanuel Bernard wrote:
>>> This article scares me
>>> That would make comparison just unreliable. Still thinking it's a
>>> On Feb 27, 2009, at 15:15, Sebastian Thomschke wrote:
>>>> Sounds good, in OVal we are also using double.
>>>> Emmanuel Bernard wrote:
>>>>> values are of type long.
>>>>> Someone asked to move to double. What do you think?
On Feb 27, 2009, at 10:54, Emmanuel Bernard wrote:
On Feb 27, 2009, at 15:11, Hardy Ferentschik wrote:
> On Fri, 27 Feb 2009 15:01:40 +0100, Emmanuel Bernard <emmanuel(a)hibernate.org
> > wrote:
>> values are of type long.
>> Someone asked to move to double. What do you think?
> Kind of makes sense, since we allow to put @Min and @max onto
> decimal fields.
> Are there any disadvantages or problems with moving to double?
Looks like double is a no-go
hibernate-dev mailing list