avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] fprintf of double?


From: Sander Pool
Subject: [avr-gcc-list] fprintf of double?
Date: Sat, 22 Mar 2003 23:57:13 -0800

Hello,

I'm using the math library for the first time and I'm running into trouble.
A formula that works great in Excel is misbehaving on the AVR. Earlier
tonight I fought a similar issue in integer math but that was solved. I
can't figure this one out yet.

I'm building a table of angles in degrees based on an int8_t value which
represents the accelleration:

ADXL202_Angles[i] =
        (int8_t) ((((double)180) *
                asin((double)(i-128)/192))/M_PI);

This same formula applied to a table of values 64 through 192 works great.
On the AVR it's kinda bad.

To help me debug what's going on I built a table of doubles with
intermediary results. When I try to print them I see '?'s. So I added this
line to my code:

        fprintf(stdout, "Double: %f\n", 0.1234);

Which also produces: "Double: ?".

So, while I would really like to fix my basic problem I would first like to
know how to print a double using stdio.

Any clues? Thanks,

        Sander

PS latest WinAVR, mega128



reply via email to

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