|
In lugnet.robotics.rcx.legos, Niels Sandholt Busch writes:
> Hello everybody
>
> I am writing a program that uses floats, but I have some problems.
>
> If I write
> /******/
>
> float p;
>
> p = 0.3;
>
> if(p == 0.4)
> do something;
>
> /******/
>
>
> The if statement evaluates to true.
>
> Is there anything special I have to do to use floats in legOS? Or am I
> doing something wrong. All help will be greatly appreciated.
>
>
> Niels Sandholt Busch
Double check the actual program you are test to make sure that you don't have:
p = 0.4 /* Only one = */
This is the number one "c" typo and is easy to overlook
Lester been there, done that
|
|
Message is in Reply To:
| | Floating ponts ??
|
| Hello everybody I am writing a program that uses floats, but I have some problems. If I write /******/ float p; p = 0.3; if(p == 0.4) do something; /******/ The if statement evaluates to true. Is there anything special I have to do to use floats in (...) (24 years ago, 3-May-01, to lugnet.robotics.rcx.legos)
|
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|