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: Kai Torben Ohlhus
Subject: [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible
Date: Sun, 6 Feb 2022 09:34:15 -0500 (EST)

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

Okay, I fixed the remaining issues and I am sorry for the long ldexp(f)
discussion.  At some point I started to confuse myself.  In short std::ldexp
works:

1. C11 has ldexp and ldexpf and a macro to overload.
2. C++11 only has std::ldexp with proper overload for float and "long double".
 No need to call something else and
https://en.cppreference.com/w/cpp/numeric/math/ldexp should be corrected to
not contain those overloads with "f" and "l" suffix 😓

> I was thinking the only difference between `elem` and `xelem` is that the
latter doesn't check for out-of-range indices. By that, it's slightly more
efficient than `elem`. If you are sure that you'll not exceed the range of the
array, you could use `xelem`. Is there really a difference with respect to
"unique data"?

The difference between elem and xelem is best described in the code
https://octave.org/doxygen/6.2.0/df/dd0/Array_8h_source.html#l00499


T& elem (octave_idx_type n)
{
  make_unique ();
  return xelem (n);
}


The feature with range checking is "checkelem()".

    _______________________________________________________

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]