Go to Post Isn't that the name of the game... Roomba Rumble? - Mr. Van [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Spotlight this post!  
Unread 08-08-2005, 04:19
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: Strange products upon running code...

Back in the late 1970's and early 1980's (when I was in college) you learned a lot of tricks to make integer arithmetic work efficiently*.

Remember the Pi approximation by remembering the sequence 113355. Split into two different 3-digit integers and ask yourself if Pi is greater than or less than one? Voila! Pi = 355/113

Nowadays, there are tools to assist with computing ratios. I use Mathcad which will compute ratios and allow you to adjust for accuracy. As examples which are much harder to remember than Pi:

Sqrt(2) = 239/169 (or 577/408)
e = 193/71 (or 1264/465)

When applying any ratio in embedded systems, remember to multiply first and then divide and to watch for numeric overflows...

By the way, this numerical approximation was "discovered" over 2500 years ago (Google: Zu Chongzi or 113355)... All we had to do was to learn to apply it.

Mike

* The first computer I built from scratch had a Z80 (8-bit) processor running at 3.579545 MHz (NTSC color burst frequency). It took minutes to do any non-trivial math operations...
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Out of the Box Camera Code russell Programming 9 21-10-2009 05:28
Team THRUST - Kevin's Code and Camera Code Combine Chris_Elston Programming 3 31-01-2005 22:28
Problem running compiled code jskene Programming 10 23-01-2005 21:13
heres the code. y this not working omega Programming 16 31-03-2004 15:18
Strange IR sensor movement with default tracker code wun Programming 5 19-03-2004 10:51


All times are GMT -5. The time now is 00:13.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi