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

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

[Octave-bug-tracker] [bug #31512] Problem with code on Linux octave 3.2.


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #31512] Problem with code on Linux octave 3.2.3 and 3.2.4/// OK on mac w/ 3.2.3
Date: Sat, 06 Nov 2010 14:54:59 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101028 Iceweasel/3.5.15 (like Firefox/3.5.15)

Follow-up Comment #8, bug #31512 (project octave):

That you get "correct" results with Octave on one system and not another
would seem to indicate a problem with the system math library, not Octave, but
I would still like to understand what is happening.  I can see some issues
with the way ranges are implemented in the current sources (but not 3.2.x, I
think).  I will start a discussion on the Octave maintainers mailing list
about that.

I also see what I think is unusual behavior of fmod on my system.  What does
the following program print on your system where you have the problem with
rem/mod?  Here, I see


x = 0.5
y = 0.1
floor (x / y) = 5
x - y * floor (x / y) = 0
fmod (x, y) = 0.1


which is definitely a surprising result.  Since fmod is the function used by
Octave to compute the remainder, this is the same result that Octave will
compute on my system.  If this is a bug, then I think the right place to fix
it is in the system math library, or perhaps in gnulib.


#include <iostream>
#include <cmath>

int
main (void)
{
  double x = 0.5;
  double y = 0.1;
  std::cout << "x = " << x << std::endl;
  std::cout << "y = " << y << std::endl;
  std::cout << "floor (x / y) = " << floor (x / y) << std::endl;
  std::cout << "x - y * floor (x / y) = " << x - y * floor (x / y) <<
std::endl;
  std::cout << "fmod (x, y) = " << fmod (x, y) << std::endl;

  return 0;
}



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?31512>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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