Here is a revised test program:
And the output:
The difference seems to be that LLVM promotes a non-complex argument to its complex equivalent and uses 'exp(y*log(x))' on those two values. GCC computes the result as a special case for a non-complex base and a complex exponent. Both runtimes agree on the underlying return values, they just disagree about whether 'pow(double, complex<double>)' should be computed as a special case or not.
So basically the same as this difference in Octave when built with GCC:
If built with LLVM these will return the same thing.
I can't tell from cppreference whether this is an ambiguity in the spec or whether either one is definitively correct.
|
I can confirm that this bug is entirely within the LLVM libc++ standard library.
The following C++ program reflects a relevant piece of what Octave is doing in the failing test:
This program prints '(-inf,inf)' as expected, except when compiled with the LLVM C++ library:
Does anyone know if this result is dictated by the C++ standard? If so, is there already an open LLVM bug report that we can link to?
|
When octave compiled with clang and llvm's libc++ library
(which is usually the case on macOS), the test general/logspace.m
fails:
This particular case is on Fedora 29, clang 7.0.1 libc++ 7.0.0.
hg id ada14ef3067f (stable)
The test passes when octave compiled with clang and libstdc++.
Dmitri.
--
|