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

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

[Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible
Date: Fri, 4 Feb 2022 05:13:22 -0500 (EST)

Follow-up Comment #12, bug #61968 (project octave):

I haven't tested anything. Just a few remarks from reading the patch:

> On many implementations, ldexp is less efficient than multiplication or
division by a power of two using arithmetic operators.

Did you check if that has a measurable difference?

What is the difference between `pow3` and `pow2` in your test?


+%! f = str2num (char ({'1/2','pi/4','-3/4','1/2','1-eps/2','1/2'}'));


That coding pattern looks odd. Why not use something like this directly?


+%! f = [1/2, pi/4, -3/4, 1/2, 1-eps()/2, 1/2];



+      map_2_xldexp (y, f, e, ldexpf);


Why do you use that pattern of passing a function handle? Why not use
`std::ldexp` in both cases (single and double precision). The standard defines
overloads for both anyway:
https://en.cppreference.com/w/cpp/numeric/math/ldexp


+    warning_with_id ("pow2:imag_ignored", "pow2: Imaginary part is
ignored.");


Warning ids in core Octave should start with "Octave:" and use "-" instead of
"_".


+          int ee = static_cast<int> (e.elem (f.ridx (i), col - 1));


You are using `xelem` in most of the other cases. Here, too?

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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