Re: Floating point calculations on 16 uC




"db" <dbahlmann@xxxxxxxxx> wrote in message
news:1125220291.973553.315000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I'm doing floating point calculations on a Fujitsu MB90F474 16bit uC.
> All float calculations are done in the main loop context. Sometimes the
> result returns a garbage value. This seems to happen only when
> interrupts are enabled. Note that there are no globals or shared data
> involved.
>
> If anyone has had similar problems please let me know. Any advice when
> using floating point calculations would be appreciated.
>
> Regards
> Dieter
>

Either:

1: The interrupt routine is corrupting data, which happens to be where the
floating point math routines store values.

2: Your stack is too small. Including floating point values in your main
loop will increase stack usage somewhat.

3: Your floating point library is not re-entrant and you are using float
variables within the ISR.


Most likely it's number 2. Should not be number 3 as it's not a good idea
to use float values in an ISR anyway.

Regards,
Richard.


http://www.FreeRTOS.org



.



Relevant Pages

  • Re: C sucks at math? (help)
    ... the floating point hardware or emulation does. ... What you need to do is figure out what degree of precision you need, and after all of the calculations, perform your fix. ... At any rate, this isn't C's fault, it's the fault of IEEE's float specification, that says that you only need 32 bits of precision, instead of infinity. ...
    (comp.lang.c)
  • Floating point calculations on 16 uC
    ... I'm doing floating point calculations on a Fujitsu MB90F474 16bit uC. ... All float calculations are done in the main loop context. ... result returns a garbage value. ...
    (comp.arch.embedded)
  • Re: Does "float" always occupy 32 bits
    ... I don't think that float could be much smaller than 32 bits. ... my calculations, a floating point number represented in the ... format that the Standard expects would need approximately 28 bits ...
    (comp.lang.c)
  • Re: weird problem
    ... I already told you that the comparison between an integer and a float ... And now a question about something else: why do you use floating ... use then to copy a float into a char *1. ... binary representation doesn't resemble a string like "123.46343" ...
    (comp.lang.c)
  • Re: Errors cancel sometimes
    ... I thought that it was remarkable, so I'm remarking on it. ... Goldberg's "What Every Computer Scientist Should Know About Floating ... elements of accurate numerical calculations on a computer as well. ... I'd be happy to have any pointers to more modern works that cover the ...
    (comp.programming)