Re: Tough problem...



This situation occurs in FFT, when the length of the FFT goes in to
million of points. The sin and cos functions become inaccurate when
the i in sin(i*arg) goes in to millions.

I'm no expert here, and I dont quite get where the i comes from, but
if it's an loop index, couldn't you do something like this:

var
i: integer;
j: double;
begin

j:= start_value;
for i:= start_value to end_value do
begin
compute sin(j*arg)
j:= j + 1;
if j > TWO_PI then
j:= j - TWO_PI;
end;
end;

Certainly not perfect, but should hold on to more precision than using
sin(i*arg) straight up, i think?

That won't work if arg has a fractional part.

--
The Fastcode Project: http://www.fastcodeproject.org/
.



Relevant Pages

  • Re: Tough problem...
    ... The sin and cos functions become inaccurate when ... sinstraight up, i think? ...
    (borland.public.delphi.language.basm)
  • Re: Sine and Cosine Accuracy on AMD64 and Pentium 4
    ... > 2) It seems to me you're testing the output of the log function> as ... Note that this does not depend at all on the accuracy of the sin ... and cos functions. ... important than the accurate kinetic energy. ...
    (comp.compilers)
  • Re: WTC Towers: A Top-Down Controlled Demolition?
    ... So thats it either play humble or arrogant or both maybe I dont know ... what makes sin or what it is really but the giant Sloth is named after ...
    (sci.physics.relativity)
  • Re: text
    ... should never give out your SIN to the public. ... Income taxes for 2007.We dont have any finnancial ... I dont has any finnancial income because I was,t ...
    (soc.culture.russian)
  • Re: would robby sleep with a married woman if she was super hot?
    ... only if they were seperated and about to divorce. ... i dont see how i could be breaking the sin of ...
    (rec.sport.pro-wrestling)