Page 1 of 1

Float Error?

Posted: Thu Nov 01, 2012 9:19 pm
by Drnkhobo
Hey support, im getting really strange readings from a module of mine.

So this is my set up:

I have a wave player feeding into a meter. Now the mono stream (blue) goes straight to a rms module which calculates in dspcode (thanks exo for the idea!) and connects (still blue) to a Mono2Float.I then use this to run my meter.

So far, we are ok. Now my problem comes in when the signal (from wave player ) drops to -inf (dB) - silence, and then back again. I tested this with a signal (.wav) i made which outputs at -2dB then drops instantly to silence . . .then back again to -2dB.

When the signal drops, I get a -1.#IND from the M2F module. . . Can you tell me what it means?
My meter then doesnt display correctly because the level is -1.#IND ? ? ?

I have searched and not 1 result came up! Ha, google, you are not ALL knowing!

*EDIT
To reset the meter, i disconnect the wave player then reconnect it.

Thanks!

Re: Float Error?

Posted: Thu Nov 01, 2012 9:49 pm
by MyCo
-1.#IND means "indeterminate", it's the same like NaN (Not a Number). It happens, when an operation couldn't generate a valid result. Most of the time, when you get this, it means: You tried to divide by zero.

Re: Float Error?

Posted: Thu Nov 01, 2012 9:55 pm
by Drnkhobo
Thanks, MyCo, that makes sense, I was getting QNAN errors before :roll:

Ive been looking into this and can only find a division in my code, where the rms happens. . . :evil:
I dont understand how to get around this? How can I "check" for a bool , for the -1.#IND

:)


** So i got a basic check going. I basically check if float is < 1 , then true, else false.
That way i get a false when it goes to -1.#IND

Re: Float Error?

Posted: Thu Nov 01, 2012 10:13 pm
by MyCo
a test for nan/ind is pretty simple. eg. when you want to check the variable "val", it's just:

Code: Select all

val == val


this is always true for defined values, but not for nan/ind.

But it's always better to avoid nan/ind so that they don't get generated. Can't tell you how you get this, because I don't have the schematic.

Re: Float Error?

Posted: Thu Nov 01, 2012 11:29 pm
by Drnkhobo
No need MyCo,

Been fixed by a denormal remover, dont know why I didnt think about it before! :D



EDIT - Spoke too soon! I know the problem, its when the rms gets an average over n samples.
When the signal is silence, the rms tries to get an avr of silence! ( avr = x/ns = 0!)

Re: Float Error?

Posted: Thu Nov 01, 2012 11:43 pm
by Drnkhobo
MyCo wrote:

Code: Select all

val == val

- can that work in the dsp code module?

Re: Float Error?

Posted: Fri Nov 02, 2012 12:07 am
by MyCo
yes, it's happening in the processor.

Re: Float Error?

Posted: Tue Nov 06, 2012 1:49 pm
by Drnkhobo
So 5 days on and no luck to destroy the monster that is -INF .

Ive tried adding a small value, denormal remover, abs, max . . .
:(

Its strange because i have 2 meters, one on input and one at output. Only the output meter gets this error when the signal drops and the input gain is LOW. So it seems to be in very low numbers.But the signal drops to silence and the input meter gets it fine so. . . ?

:?:

Re: Float Error?

Posted: Tue Nov 06, 2012 3:08 pm
by MyCo
just post a schematic or send it to me via private message, and I'll have a look

Re: Float Error?

Posted: Wed Nov 07, 2012 9:57 pm
by Drnkhobo
Hey MyCo,

Got it working now, kinda forgot about this thread. . . :cry: