|
| From: | anonymous |
| Subject: | [Octave-bug-tracker] [bug #59149] [octave forge] (signal) Resampling from 22050 to 48000 Hz introduces strange and unexpected artifacts |
| Date: | Thu, 24 Sep 2020 10:49:48 -0400 (EDT) |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0 |
Follow-up Comment #29, bug #59149 (project octave):
It turns out that this problem is completely independent of Octave.
Here's a very small test that shows the effect of -ffast-math.
#include <iostream>
int main()
{
double a = 1.0, b = (a + 1e-3) - 1e-3;
if (a==b)
std::cout << "Equal\n";
else
std::cout << "Unequal\n";
}
With -ffast-math they're equal. Without it they're unequal.
The use of == with floating point is unwise, but somehow -ffast-math makes the
intended logic work properly.
The quick workaround that a user can do to get usable results is to use
-ffast-math when building packages that use == on doubles. The better fix for
the package is to change "a==b" with "abs(a-b) <= 1e-4" or a similar
tolerance, which will then work without -ffast-math.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59149>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
| [Prev in Thread] | Current Thread | [Next in Thread] |