Hello, list. I just published this blog post, I hope that it is useful to some of you: https://www.dariosanfilippo.com/blog/2020/handling_inf_nan_values_in_faust_and_cpp/ .
Your comments are welcome. In the post, I have collected a set of cases to summarise some or most of the inf and NaN arithmetic in C++. Attached, you can also find a program to test the same cases in Faust double-precision. (I assume that Faust single-precision behaves the same way.) The test uses delayed test signals to trick the compiler, so to speak, and generate the desired cases for audio streams in Faust without optimisation. The results are commented in the file attached. It looks like only five cases differ from C++. One thing that I noticed: import("stdfaust.lib"); inf = ma.INFINITY ^ 2; process = mem(inf * no.noise), mem(inf); at n = 0, we have NaN for channel 1, and 0 for channel 2. As we thought with Stéphane, mem(const * sig) seems to be translated into const * mem(sig) by the compiler, resulting in 0 * inf in C++. Since Faust is already taking care of this for cases such as inf * 0 or 0/0 (signals), how do you consider the possibility of adding versions of all the operators and functions that can currently produce inf or nan as domain-limited functions that, structurally, cannot generate inf or nan, namely by deploying min(), max(), and the limits constants? The user could then choose between efficiency or robustness. Maybe it could also be good to add MAX = ma.INFINITY in maths.lib to distinguish it from C++' inf. Ciao, Dario
inf_nan.dsp
Description: Binary data
_______________________________________________ Faudiostream-users mailing list Faudiostream-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/faudiostream-users