- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am having trouble assigning a negative value to a float variable. The first problem happens here assigning one variable value to another:
testAvg = atan2(yAccum / avgCount,xAccum / avgCount) * 180.0f / M_PI;
directAvg = testAvg;
testAvg = -112.5
directAvg value is -82.5
Secondly, directly trying to assign a value:
directAvg = -112.5f;
directAvg value is 0
I am missing something very basic here. Thank you for your help.
Regards,
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, Tom, I think you can imagine that assigning negative values to a float variable does certainly work. So the bug lures on a different place, not the assignment.
How do you get knowledge of the actual value? Debugger output?? sprintf()???
When sprintf() make sure Buffer large enough, heap size set to 0x0200 and newlib nano float formatting enabled.
Can you verify (by setting an address breakpoint) that no write access happens unwanted to your variables?
Bob