[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: |
Sun, 6 Feb 2022 04:03:19 -0500 (EST) |
Follow-up Comment #17, bug #61968 (project octave):
`std::ldexpf` not existing in in GCC nor clang might be a compiler bug, a
documentation issue, or an (intentional) deviation from the standard. I didn't
find any further information on that.
But honestly, I don't know why anyone would even need to use `std::ldexpf`.
Instead, it would be clearer and more in the spirit of C++ to just use
`std::ldexp` (and potentially cast the input argument to `float` if that is
really what one would like to do).
@Kai: Why do you prefer the C functions `ldexp` and `ldexpf` over the (easier
to use) C++ function `std::ldexp`? After all, Octave is mainly written in C++.
And your proposed implementation of `Fexp2` is also written in C++ (with some
functions mixed in from C for some reason I'd like to understand).
> pow2(f,e) with two arguments calls ldexp. This is documented Matlab
behavior (comment #0): discussions forbidden 😅
As I'm understanding their documentation, they are describing the function by
comparing it to `ldexp`. They don't *actually* write that the function is
implemented with `ldexp`...
But that's just a minor detail.
It might still be interesting to check how much of a performance difference
there is between using `std::exp2` or `std::ldexp` for different compiler or
STL implementations.
> Somehow in Octave the C symbols leak (intentionally?) into the C++
"octave::" namespace. I got hard errors using std::exp2, etc.
Tbh, I don't understand what you are trying to say...
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"?
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?61968>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, (continued)
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, John W. Eaton, 2022/02/01
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Markus Mützel, 2022/02/01
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Markus Mützel, 2022/02/01
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Kai Torben Ohlhus, 2022/02/04
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Kai Torben Ohlhus, 2022/02/04
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Markus Mützel, 2022/02/04
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Markus Mützel, 2022/02/04
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Kai Torben Ohlhus, 2022/02/05
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, John W. Eaton, 2022/02/05
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, John W. Eaton, 2022/02/05
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible,
Markus Mützel <=
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Markus Mützel, 2022/02/06
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Kai Torben Ohlhus, 2022/02/06
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Kai Torben Ohlhus, 2022/02/06
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Markus Mützel, 2022/02/06
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Markus Mützel, 2022/02/06
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Kai Torben Ohlhus, 2022/02/06
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Markus Mützel, 2022/02/07
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, anonymous, 2022/02/08
- [Octave-bug-tracker] [bug #61968] pow2 with two arguments is not Matlab compatible, Markus Mützel, 2022/02/08