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

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

[Octave-bug-tracker] [bug #33168] abs function in octave c++ API convert


From: foehler
Subject: [Octave-bug-tracker] [bug #33168] abs function in octave c++ API converting standard C++ type to int
Date: Tue, 26 Apr 2011 23:23:30 +0000
User-agent: Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20100101 Firefox/4.0

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

(follow up from previous post)

+verbatim
#include <octave/oct.h>
#include <cmath>

DEFUN_DLD (abs_test, args,,
  "Test abs")
{
double test=args(0).double_value();

octave_stdout<<test<<" :octave abst"<<abs(test)<<"n";
octave_stdout<<test<<" :cmath  abst"<<std::abs(test)<<"n";

return octave_value_list ();
}
+verbatim

This is the correct behaviour, considering the definition of 'abs'
here
<http://octave.sourceforge.net/doxygen/html/pr-output_8cc.html#a8385cf3992d8cff96a03788eed483e73>
which only accept int-like var, and the definition of 'abs' here
<http://octave.sourceforge.net/doxygen/html/functions_0x61.html#index_a> where
only the octave type are allowed.

Defining double as 1x1 NDArray is not very convenient. If octave 'abs' can not
accept double, should a warning be issued at compilation ( and suggest the
<cmath> version ?)

However my C++ skill are limited and I am far from understanding the C++ API.
Could someone confirm this ?

Kind regard,
 Fabrice

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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