Float Error?

For general discussion related FlowStone
Post Reply
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Float Error?

Post 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!
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Float Error?

Post 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.
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Float Error?

Post 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
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Float Error?

Post 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.
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Float Error?

Post 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!)
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Float Error?

Post by Drnkhobo »

MyCo wrote:

Code: Select all

val == val

- can that work in the dsp code module?
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Float Error?

Post by MyCo »

yes, it's happening in the processor.
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Float Error?

Post 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. . . ?

:?:
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Float Error?

Post by MyCo »

just post a schematic or send it to me via private message, and I'll have a look
Drnkhobo
Posts: 312
Joined: Sun Aug 19, 2012 7:13 pm
Location: ZA

Re: Float Error?

Post by Drnkhobo »

Hey MyCo,

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