Re: Tough problem...
- From: "Avatar Zondertau" <avatarzt@xxxxxxxxx (please reply to newsgroup)>
- Date: Wed, 28 Jun 2006 08:00:40 +0200
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/
.
- Follow-Ups:
- Re: Tough problem...
- From: Lord Crc
- Re: Tough problem...
- References:
- Tough problem...
- From: Atmapuri
- Re: Tough problem...
- From: Eric Grange
- Re: Tough problem...
- From: Atmapuri
- Re: Tough problem...
- From: Lord Crc
- Tough problem...
- Prev by Date: Re: Tough problem...
- Next by Date: Re: Fastcode FillChar B&V 1.6.0
- Previous by thread: Re: Tough problem...
- Next by thread: Re: Tough problem...
- Index(es):
Relevant Pages
|