discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] Dealing with `divide 0` or `Inf` in GNU Radio C++ cod


From: Jeon
Subject: [Discuss-gnuradio] Dealing with `divide 0` or `Inf` in GNU Radio C++ code.
Date: Wed, 19 Aug 2015 19:50:32 +0900

Let's think about the following auto/cross correlator: http://i.imgur.com/Fy5hdVj.png
I've placed `divide` because I need to normalize the correlation result.

If we place `null source`, or `constant source with value of zero` right before the `pad source`, the simplified form of the correlator becomes 0 divided by 0.

I've placed `time sink` right after the `pad sink` then, I can see the line hit the infinity. With a simplified flow graph: http://i.imgur.com/Msx9EQj.png

Back to the my correlator, how can I handle such `infinity` value coming into the next block?

My guess is that if a source block is a type of float, then `infinity` might have a maximum value of float. So, I think I can reject `infinity` value with `if (in[i] > threshold)`, where `threshold` is big enough, for correlator it is fine to have a value just larger than one.

Do you think what I guess is right? Or can some boost numeric types, or PMT help somehow to deal with it?

In addition, not important.
In pages http://en.cppreference.com/w/cpp/types/numeric_limits/infinity and http://en.cppreference.com/w/cpp/numeric/math/INFINITY,
non floating point numeric types can't handle infinity.
Is it also applied to GNU Radio?

Regards,
Jeon.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]