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: Tue, 1 Feb 2022 11:56:38 -0500 (EST)

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

Some more comments on the patch:

+  if (! args(0).is_single_type () && ! args(0).is_double_type ())


Why not `! args(0).is_float ()`?


+  if (! args(1).is_single_type () && ! args(1).is_double_type ())


Same.


+      FloatNDArray e = args(0).float_array_value ();


Typo? Should be `args(1)` instead?

IIUC, `ov.exp2 ()` and `Fexp2 (ov)` would do two different operations. (The
former essentially calls the C function from math.h `exp2`, the latter
`ldexp`.) Is that what we want? Or do we just need to live with that
difference...

Also from https://en.cppreference.com/w/c/numeric/math/ldexp
> On many implementations, ldexp is less efficient than multiplication or
division by a power of two using arithmetic operators.

More off-topic: Why are we using C functions (like ::exp) in many cases
instead of their corresponding C++ functions (like std::exp)?

    _______________________________________________________

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]