Hi,
This looks like a general programming problem to me. It is always dangerous to ask for equality on real numbers. Because of a rounding problem in the calculation (because of the way computers work), the sum is not exactly equal to the number on the right hand-side.
The usual algorithm to compare real numbers for equality, up to say 3 decimal numbers, is the following, comparing integers instead (replace 1000 with e.g. 100 for 2 decimal places):
fn:round($n1 * 1000) = fn:round($n2 * 1000)
Regards,