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: anonymous
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:50:39 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0

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

c = a/b causes implicit rounding for integers in Octave, not native mode
integer division. That was the reason for idivide if we need the floor or
other mode. But here idivide itself is rounding incorrectly for numbers above
flintmax, so testing c = a/b would need a workaround too.

How about this:


c = a/b;     ## causes integer rounding
if (c*b > a && mode is floor)
  c -= 1;
elseif (c*b < a && mode is ceil)
  c += 1;
etc for the other modes


But this seems flaky too. Not sure how to access native C++ integer division
in an Octave function without going through double?

    _______________________________________________________

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]