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

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

[Octave-bug-tracker] [bug #51779] bsxfun unit tests occasionally fail on


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #51779] bsxfun unit tests occasionally fail on certain random inputs
Date: Fri, 18 Aug 2017 01:04:22 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #5, bug #51779 (project octave):

I made the following change to fix this


diff --git a/liboctave/util/oct-inttypes.cc b/liboctave/util/oct-inttypes.cc
--- a/liboctave/util/oct-inttypes.cc
+++ b/liboctave/util/oct-inttypes.cc
@@ -753,7 +753,7 @@ pow (const octave_int<T>& a, const doubl
 template <typename T>
 octave_int<T>
 pow (const float& a, const octave_int<T>& b)
-{ return octave_int<T> (std::pow (a, b.float_value ())); }
+{ return octave_int<T> (std::pow (static_cast<double> (a), b.double_value
())); }
 
 template <typename T>
 octave_int<T>


Basically, pow(float,octave_int<T>) used to call pow(double,double), and was
unintentionally changed at this point to call powf(float,float).

It's not immediately obvious which one of these is "correct", but it is
empirically obvious that the new code calling powf is giving a different
answer than what Octave normally gives for the scalar operation of
single(x)^int32(y).

I think this may have been discussed on another report, but should a mixed
operation like single(x)^int32(y) be the same as
int32(double(x)^double(int32(y)))? Or should it be the same as
int32(single(x)^single(int32(y)))?

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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