Re: [xml] XPath mod operator problems



"Bjorn" == Bjorn Reese <breese mail1 stofanet dk> writes:

    Bjorn> Geert Kloosterman wrote:
    >> There's one other thing.  Isn't the real problem the comparison of the
    >> floats?  Comparing floats is a tricky thing.

    Bjorn> Indeed. Because of the inexact representation of
    Bjorn> floating-point number we must use an inexact comparison
    Bjorn> like this

    Bjorn>   A - epsilon < B < A + epsilon

    Bjorn> where A and B are the floating-point numbers we want to compare, and
    Bjorn> epsilon is the (positive) tolerance.

How does this take in acount the 'floatingness' of a floating point
number?   For example, when comparing two numbers that are around 10,
an epsilon of 1e-10 seems fine.

But what in case the numbers to compare are in the order of magnitude
of 1e-15, for example 4.34e-15 and 5.42e-15?   With an epsilon of
1e-10 the difference between them will not be found.  

This means epsilon should be variable, depending on the size of the
numbers being compared.  Am I correct?

Geert



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]