[LAD] Is -ffast-math safe for audio?

Hermann Meyer brummer- at web.de
Fri Nov 23 05:09:07 CET 2018


Am 23.11.18 um 03:56 schrieb Hermann Meyer:
>
> Am 22.11.18 um 23:44 schrieb Robin Gareus:
>> On 11/22/2018 09:27 PM, Hermann Meyer wrote:
>>>
>>> However, problems with NAN's and INF's when use -ffinite-math-only
>>> occurs only when we save preset values to file, and only sometimes 
>>> then.
>> A shot in the dark..
>>
>> Serializing a float in most parts of the world uses comma as decimal
>> separator. e.g. "0,5"
>>
>> Reading this in the C-locale (dot as decimal separator) with c/c++
>> standard library functions returns 0. This may lead to a division by
>> zero later.
>>
>> Cheers!
>> robin
>
> that happen during write, not during read. During read, nan's and 
> inf's will be replaced by standard values when detected, but it mean's 
> that original settings been lost.
>
> The values been saved as 0.5 with a dot, the comma is used as 
> separator between the entry's.
>
> (and no error with entry separation ever happen)
>
> It could happen as well to values which may ain't been used/changed 
> during a session.
>
> And it happen in a non-reproducible way. Very strange, and indeed only 
> when -ffinite-math-only
>
> is turned on.
>
> I've tried for weeks to find out what really happen, but could only 
> nail it to -ffinite-math-only.
>
> -ffast-math, on the other hand changes the resulting sound, it's 
> minimal, but, notable.
>
> The only flag from the -ffast-math macro we still use is -fno-math-errno.
>
>
> regards
>
> hermann
>

As a side note, in my side project GxPlugins.lv2 I still use -ffast-math 
without problems.


More information about the Linux-audio-dev mailing list