We have been discussing the possibility of allowing @Min and @Max to get double values instead of the current long.
There are various problems with that though.
http://firstclassthoughts.co.uk/java/tr ... traps.html
explains a lot of traps around double
Quote:
To evaluate @Min @Max we do comparison so
say @Max(2.3d) applied on 2.2999999999999997d
System.out.println(2.2999999999999997d < 2.3d); => displays false
System.out.println(new BigDecimal(""+2.2999999999999997d).compareTo(
new BigDecimal(""+2.3d) ) == -1); => displays false
System.out.println( new BigDecimal(9223372036854775807l).compareTo(new
BigDecimal(9223372036854775807d)) == 0 ); => displays false
not a pleasant surprise
To which Sebastian replies
Quote:
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 double
properties? And if so how do we address this issue?
So
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.
Thoughts?