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

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

[Octave-bug-tracker] [bug #59623] [octave forge] (image) bwdist for quas


From: Hartmut
Subject: [Octave-bug-tracker] [bug #59623] [octave forge] (image) bwdist for quasi-euclidean case fails on i386
Date: Sat, 5 Dec 2020 12:09:43 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:83.0) Gecko/20100101 Firefox/83.0

Follow-up Comment #1, bug #59623 (project octave):

Thanks for letting us know this, Rafael. And also thanks for the patch.

In our current code in bwdist.cc, the function abs() is called with an
argument of the integer type "short". (I am unsure if this is a signed or
unsigned integer type.) 

I am not experienced in C++. Reading the documentation, it sounds to me that
it is alright to call abs() on integer types. fabs() seems to be mostly ment
for floating point input types. I only find this disclaimer in the docs of
abs: "If std::abs is called with an unsigned integral argument that cannot be
converted to int by integral promotion, the program is ill-formed.". But I
also read in the docs of fabs: "For integral arguments, the integral overloads
of std::abs are likely better matches."

Maybe someone else with more experience in C++ can jump in and comment here?

(An additional question that comes to my mind is: If we exchange 4 of the 6
occurances of abs() with fabs() in this function "quasi_euclidean", why not
also the two other ones?)

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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