View Single Post
  #3   Spotlight this post!  
Unread 26-12-2005, 20:07
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Floating point math in PBASIC

Quote:
Originally Posted by sparksandtabs
I was wondering if anyone can help me with how to do floating point math on a Basic Stamp 2?
Quote:
Originally Posted by Mike
Multiply everything by 1000.
That'll let you represent fractional values, but it's fixed point, not floating point.

To do true floating point, you need to use a variable scaling factor rather than just picking e.g. 1000 in advance, and you have to keep track of the scaling when multiplying and dividing. (When you add or subtract, you need to equalize the scaling factors first.)