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

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

[Octave-bug-tracker] [bug #52627] Failing BIST tests on Mac OS X


From: Rik
Subject: [Octave-bug-tracker] [bug #52627] Failing BIST tests on Mac OS X
Date: Mon, 11 Dec 2017 14:19:46 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #13, bug #52627 (project octave):

@Mike: I was working from your list.  I knocked off the issue in fileattrib.m
and the issue in camzoom.m.  I'm not sure I want to tackle the issues in the
math libraries.  

For the sorting issue, I'm pretty sure that the problem is a cast to float on
the constant M_PI.  Could someone with access to a Mac try this C++ program
and report the results?


#include <cmath>
#include <complex>
#include <iostream>

using namespace std;

int main (void)
{
  complex<float> x1;

  cout.precision (17);
  x1 = complex<float> (-0.0f, -1.0f);
  cout << "-0 - 1i: " << std::arg (x1) << "\n";
  x1 = complex<float> (1.0f, 0.0f);
  cout << " 1 + 0i: " << std::arg (x1) << "\n";
  x1 = complex<float> (0.0f, 1.0f);
  cout << " 0 + 1i: " << std::arg (x1) << "\n";
  x1 = complex<float> (-1.0f, 0.0f);
  cout << "-1 + 0i: " << std::arg (x1) << "\n";

  cout << "static_cast<float> (-M_PI): " << static_cast<float> (-M_PI) <<
"\n";

  cout << "static_cast<float> (M_PI): " << static_cast<float> (M_PI) << "\n";

  cout << "4*atan (1): " << 4.0f * atan (1.0f) << "\n";

}


The file is attached as tst_arg.cc.  One should be able to compile it with


clang -o tst_arg tst_arg.cc


The results on my Linux machine are


-0 - 1i: -1.5707963705062866
 1 + 0i: 0
 0 + 1i: 1.5707963705062866
-1 + 0i: 3.1415927410125732
static_cast<float> (-M_PI): -3.1415927410125732
static_cast<float> (M_PI): 3.1415927410125732
4*atan (1): 3.1415927410125732


If it turns out to be the problem with casting then we could always override
the generic templated code in liboctave/util/oct-cmplx.h with a specialization
for floats on Mac platforms.



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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