Matthew Saltzman wrote:
On Tue, 2007-09-04 at 18:17 -0500, Mike McCarty wrote:
[snip]
I'm afraid I'm not very impressed with "Numerical Recipes".
I bought a copy many years ago, and found some humorous lapses
in the multi-precision FFT based math package. Things which
proved that they don't know what they are doing, I'm afraid.
Like subtracting one float from another repeatedly in a loop
instead of using fmod().
Early NR, especially NR in C, had some real laughers. (BTW, does
Well, even worse, IMO. They cribbed code from other authors,
and then removed all the comments and explanatory text from it.
For example, several of their routines are cribbed straight from
Forsythe, malcolm, and Moler "Computer Methods for Mathematical
Computations", a rather elementary text which presents fairly
well written (for the day) and commented FORTRAN. The C they
present is poorly written and sans commentary to make it understandable.
Fortran 77 have an equivalent to fmod()?. If not, that might explain
where they picked up the repeated subtraction idea. They really didn't
Yes, much of their stuff has the look of automatic translation from
FORTRAN to C.
know much C back in the early days...) I haven't seen any reviews yet,
but the third edition is just now coming out, after 15 years. More
information at http://www.nr.com. (I'm not endorsing anything here. I
have no affiliation with anyone involved with NR.)
I've had good results with Cody & Waite, though it's getting
somewhat dated (1980) and some better stuff has come along,
or so I've heard.
But, if the hardware is being used, then coding something with
less accuracy is also going to be slower.
Still may depend on the processor and exactly what instructions are
executed doing the approximation. Just because it's hardware, that
doesn't mean it will necessarily take only a few clock cycles.
Of course not. But eventually SOME hardware executes the instructions.
If the FP hardware isn't being used, then that's the first issue
to address. Even FPATAN isn't slower than doing range reduction "by
hand" whatever the accuracy. (Unless one has a guaranteed small
range of inputs, that is.)
Mike
--
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
Oppose globalization and One World Governments like the UN.
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!