On Mon, Nov 20, 2017 at 7:52 AM, Marcus Müller <muel...@kit.edu> wrote:

> I was about to commit a PR VOLKizing nlog10 [1], but it struck me that
> my processor (imho, correctly) says that log(0) == nan and log(-10) ==
> nan.
>
> Whereas the old nlog10 test case asserts that it's log_10(x<=0) == -18.
>
> So, am I allowed to break that assertion for the greater mathematical
> appropriateness and speed?


I think it would be appropriate to produce negative infinity rather than
NaN for log(0). Still not finite, but a more useful answer — you can max()
with it to get a finite lower bound if that is what your application finds
useful, whereas NaN just gives NaN.

The most common use of nlog10 is presumably log scaled FFTs. In that case,
there will be output NaN/infs any time the input signal is zeroes, which is
a plausible happening. In that context, it might break somebody's graphics
code; depending on the language and libraries used, either with an
unexpected exception or with just that frame not drawing at all (which,
since it would typically be fully outside the viewport, doesn't seem that
bad).

Certainly it would be good to make sure that the GR QT GUI widgets don't
have any trouble with the resulting NaN/infs.

Overall it seems like a reasonable change to me, for what that's worth.
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to