octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #61319] idivide fails to distinguish between c


From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #61319] idivide fails to distinguish between ceil and floor for inputs close to perfect squares
Date: Sat, 9 Oct 2021 10:04:27 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Firefox/60.0

Follow-up Comment #2, bug #61319 (project octave):

Why going through floating point: because it is easier. But as you have found,
it does not work if the results are so large and in exact arithmetic so close
to an integer that in double precision they are exact that integer, because
then no rounding does happen.

I would say that there is no Matlab compatibility to break: there is a
documentation, which agrees between Matlab and octave, so octave should follow
its documentation (which at the moment it doesn't do), and if this is resolved
and the results don't agree, then it is a Matlab bug (because it would mean
that it doesn't follow its own documentation). 

As to why not integer division: yes, I also think that this would be the way
to do it. One would do the integer division according to its semantics (this
is compiled code, and hopefully there is no bug there) c=a/b, then test
whether c*b==a (in the native multiplication of the integer class), and if
this is not true, add or subtract 1 to c (or do not change it at all)
according to the chosen rounding mode. This would be not less performant, and
should work as far as I can tell.

Rounding numerator and denominator separately would not work, I think.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61319>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]