To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2258
2257  |  2259
Subject: 
Re: Incorrect result
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Wed, 30 Jan 2002 20:29:56 GMT
Viewed: 
2051 times
  
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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR