discuss-gnuradio
[Top][All Lists]
Advanced

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

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


From: Jeff Long
Subject: Re: [Discuss-gnuradio] Dealing with `divide 0` or `Inf` in GNU Radio C++ code.
Date: Wed, 19 Aug 2015 07:25:18 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

Jeon,

You can add an appropriate constant before the divide and compensate for it afterward. The exact math will depend on the values coming out of the correlators.

Jeff

On 08/19/2015 06:50 AM, Jeon wrote:
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.


_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio





reply via email to

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