The Struts Validator floatRange seems to have roundoff error.
For the validation.xml configuration snippet below, user input of
90.00001 fails validation, as expected, but 90.000001 does not.
<field property="baseLocalities.latitude" depends="float,floatRange">
<var>
<var-name>min</var-name>
<var-value>-90</var-value>
</var>
<var>
<var-name>max</var-name>
<var-value>90</var-value>
</var>
</field>
Is this a known problem?
What is the best way to work around it?
Thanks,
Michael
>For the validation.xml configuration snippet below, user input of
>90.00001 fails validation, as expected, but 90.000001 does not.
I did not analyse your particular problem, but nearly always such
anomalies are God's fault for making 0.1 a repeating fraction when
expressed in binary. See http://mindprod.com/floatingpoint.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Andrew Thompson - 30 Sep 2005 22:24 GMT
>>For the validation.xml configuration snippet below, user input of
>>90.00001 fails validation, as expected, but 90.000001 does not.
>
> I did not analyse your particular problem, but nearly always such
> anomalies are God's fault for making 0.1 a repeating fraction when
> expressed in binary. See http://mindprod.com/floatingpoint.html
Did God command us to use base 10? In fact, what with the
entire Adam/Eve, 2x2 on the ark deal, it would seem '2'
is more likely the 'divine' number (for the Judeo-Christians).
If we didn't use base 10, why would we think twice about
the representation of such an obscure fraction as 1/10?