Bug#673765: dom4j FTBFS with openjdk-7
niels at thykier.net
Wed May 23 08:48:26 UTC 2012
On 2012-05-23 10:19, James Page wrote:
> Hi Niels
> On 23/05/12 07:27, Niels Thykier wrote:
>> However, I must admit I am a bit concerned in the use of of "!="
>> with reals (floats/doubles). To my understanding (in at least
>> C/C++) that is very likely to always be true due to even minor
>> rounding errors. Presumably this is why upstream used
>> "Math.round" in the first place. It is possible that it only apply
>> to expressions (and not stored values in variables) or Java handles
>> this better, but in this case, I believe a comment in the code
>> documenting this assertion would be prudent.
> I had the same concern when writing this patch but reading into this
> in a bit more detail I decided that this was actually OK for the
> following reason.
> The priority (see ) is always one of four values:
> I did a quick check and all four of these values can be represented
> accurately in Java (this is not true of all float/double literals).
> I'll update the patch with an appropriate comment to this effect.
>  http://www.w3.org/TR/xslt11/#conflict
Revisiting this, couldn't we use Double.compare(double, double) for
this? This way we should be safe from changes (if any) in how doubles
are handled in the future as well as any changes to the standard
(possible exceptions include allowing the use "NaN" or "INF" values).
More information about the pkg-java-maintainers