From: Spehro Pefhany
Subject: Re: Trig circuits
References: <email@example.com> <firstname.lastname@example.org> <email@example.com>
X-Newsreader: Forte Agent 1.92/32.572
Date: Mon, 23 Dec 2002 19:01:31 GMT
NNTP-Posting-Date: Mon, 23 Dec 2002 14:01:31 EST
On Mon, 23 Dec 2002 19:26:23 +0100, the renowned "Frank Bemelman"
>And 4) Never use 'if(((float)x==(float)y) && ((float)m!=(float)n))'.
Why, Frank? What could happen? ;-)
>I hate floats ;)
They have their place. It's nicer to be able to have the luxury of
a high-volume job where you can craft bespoke math routines that
have just what is required, but for quick and dirty < 5K pcs.
volume, when cost and performance isn't as important as getting
a solid and reliable solution out the door, compilers generally do
One that I'm working on now is about 80-90% C, with assembler to do
some fast 24-bit + 16 bit unsigned addition as well as a few
other things. I had to write a couple of bastardized C-asm
routines for unsigned * and / because I couldn't afford the library
space for longs (only 1K words total code space for everything).
If I had to do a *single* function like sin(x) for a volume
cost-sensitive product, I'd use some things from the bag 'o tricks
such as polynomials or even a LUT with interpolation. It's
easy enough to curve-fit and generate whatever accuracy is
required. I find this stuff kind of fun, but often can't
justify it these days with processing power so cheap. Consider
the MSP430 family- 60K of code space, a fast low-power 16 bit
processor, with 12-bit ADC and cost is less than $6 USD in volume.
There may even be a usable free compiler for it now.
"it's the network..." "The Journey is the reward"
firstname.lastname@example.org Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com