Subject:
|
IC Floating Point Bug
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Mon, 27 Jul 1998 23:59:45 GMT
|
Original-From:
|
Rick Moll <rickmoll@[avoidspam]mvp.net>
|
Viewed:
|
1147 times
|
| |
| |
I've been making use of floating point for the first time on the HB and
am having problems. The following program demonstrates the kinds of
bugs I've been encountering:
----(cut here)-----------------------------------
int
main()
{
float a;
float b;
float c;
/*
This program prints out the proper values for
"a" and "b", but prints "c" to be ".1250034"
rather than something closer to "0.25" as expected.
*/
a = 1.570796;
b = 6.2831;
c = a/b;
printf("%f %f %f\n", a, b, c);
}
----(cut here)-----------------------------------
I would appreciate hearing if others can duplicate this bug. I'm using
the standard "free" IC off of the "ic2853r2.zip" file.
Thanks for your help,
Rick
|
|
Message has 3 Replies: | | Re: IC Floating Point Bug
|
| (...) <snip> I get the same results with version 3.2. Curiously, if I remove the last digit in the a = 1.570796 statement (or replace it with a zero), then I get the correct answer. I guess it has something to do with specifying too many significant (...) (26 years ago, 28-Jul-98, to lugnet.robotics.handyboard)
| | | RC Car Robot Base
|
| All: I am trying to find a World Scale RC Car/Truck base for my robot. One of the items I have been looking at was the Thunder King RC Monster Truck from MRC/Tower Hobbies, but they have recently discontinued that part. Does anyone have any (...) (26 years ago, 8-Aug-98, to lugnet.robotics.handyboard)
|
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|