QNAN bei Floatmultiplikation auf 8051F und Keil

Gast #2000474
Lesenswert?

Moin,

bei der Operation
y[0] = ((ACoef[0]) * (x[0]));
bekomme ich 1.#QNAN als Ergebnis.
Was bedeutet das?
In ACoef[0] steht 2,433e-13
In x[0] steht 1,899e+7
1
float iir(float NewSample) {
2

3
    idata float ACoef[NCoef+1] = {
4
        0.00000000000024335396,
5
        0.00000000000194683167,
6
        0.00000000000681391085,
7
        0.00000000001362782170,
8
        0.00000000001703477712,
9
        0.00000000001362782170,
10
        0.00000000000681391085,
11
        0.00000000000194683167,
12
        0.00000000000024335396
13
    };
14

15
    idata float BCoef[NCoef+1] = {
16
        1.00000000000000000000,
17
        -7.70663582543307600000,
18
        25.98811769708422400000,
19
        -50.08564889641004900000,
20
        60.33895663605833400000,
21
        -46.52942830250031400000,
22
        22.42862119389475600000,
23
        -6.17879494249887260000,
24
        0.74481243984022838000
25
    };
26

27
    static float y[NCoef+1]; //output samples
28
    static float x[NCoef+1]; //input samples
29
    int n;
30
  idata float test;
31

32
    //shift the old samples
33
    for(n=NCoef; n>0; n--) {
34
       x[n] = x[n-1];
35
       y[n] = y[n-1];
36
    }
37

38
    //Calculate the new output
39
    x[0] = NewSample;
40
    y[0] = ((ACoef[0]) * (x[0]));
41
    for(n=1; n<=NCoef; n++)
42
        y[0] += ACoef[n] * x[n] - BCoef[n] * y[n];
43
    
44
    return y[0];
45
}
Gast #2003380
Lesenswert?

Hallo,

wäre es wohl möglich dass der µC bei der Berechnung der Multiplikation 
irgendwo Teilen muss, und deswegen vielleicht durch 0 teilt?
Eine Floatmultiplikation bedarf ja doch einer ganzen Menge an 
Rechenschritten auf so einem 8 Bitter.

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren