ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

SIMPLE THINGS


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

SIMPLE THINGS

Lessons from the Trenches Prime Numbers Revisited
by George Martin

Start ı Being Ardent ı An Example ı Sources and PDF

AN EXAMPLE

Letıs assume that the Area() routine is similar to Arendtıs. Therefore, in C, the algorithm would look something like Listing 1.

The comparison to 1e-6 in the example is shown because floating-point calculations can have round off problems. For example, (1.0/3.0) ı 3.0 might not equal 1.0, but 0.99999999999 instead. So, the typical approach is to check that the results agree to within some small error value (often called epsilon).

As you can see, it can be done with just about the same level of clarity or complication as C++, but there might be other considerations to take into account.

Does the C++ compiler blow up the code and make it unusable in embedded systems? Perhaps. Does C++ provide for simpler thinking for software designers? Perhaps (old dogs and new tricks). Should we start using C++ tomorrow? No, but it can no longer be ignored (donıt become obsolete).

All right, Iım done. Iıll get off the soapbox now. Next month, Iıll talk about the Motorola Coldfire CPU.

PREVIOUSNEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ıCircuit Cellar, the Magazine for Computer Applications. Posted with permission.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ