|
Robert Templeton wrote:
> rx += ((long)(b->magnitude * TA_costable[b->direction]) >> 7);
> No matter what I do, 256 * 128 / 128 = -256
256 * 128 = 32768, one higher as the biggest positive integer value. The
cast to long would help, but your cast is too late. I have not tested, but
I think
rc += ( (long)b->magnitude * (long)TA_costable[...] ) >> 7;
will help. Try output in hex, not with lcd_int!
Bye
Mike
|
|
Message is in Reply To:
| | Incorrect result
|
| This problem, unlike the other, is definitely not a result of my eyes/brain being tired or something. I thoroughly displayed every value before and after evaluation and the result is ***WRONG***. Here is the code and the values: typedef struct { int (...) (23 years ago, 30-Jan-02, to lugnet.robotics.rcx.legos)
|
4 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|