Re: bug in functions 'roundup' and 'ceil'



[Morten Welinder]

  I have attempted to "fix" this in current cvs sources.  The real
  problem is lack of understanding of binary math, but I guess we
  cannot expect to pass that message to end users.
  
  Therefore the "fix" is to be wrong on different numbers that most
  users are not likely to stumble upon.

Isn't the right fix to run ceil(x) and ceil(x-epsilon), where epsilon
is the smallest possible difference to x (x/2**52 for doubles), and
return the value closest to x?


Kjetil T.




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