Re: Tough problem...
- From: "Avatar Zondertau" <avatarzt@xxxxxxxxx (please reply to newsgroup)>
- Date: Wed, 28 Jun 2006 07:39:21 +0200
The solution is not to pass a large argument in the first place,
which can often be achieved if you're dealing with a "physical"
problem (in opposition to "mathematical" problem). The "how" will
depend on the problem, and can range from separating values
(number of rotations + angle instead of an absolute angle) to
transforming the math (using trigonometric formulas, quaternions,
etc.), using a converging series or introducing a well chosen
approximation.
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.
Try something like this:
Angle := 0;
for I := 0 to 100000 do
begin
MySin := Sin(Angle);
Angle := Angle + arg;
while Angle >= 2 * Pi do
Angle := Angle - 2 * Pi;
end;
--
The Fastcode Project: http://www.fastcodeproject.org/
.
- References:
- Tough problem...
- From: Atmapuri
- Re: Tough problem...
- From: Eric Grange
- Re: Tough problem...
- From: Atmapuri
- Tough problem...
- Prev by Date: Re: Tough problem...
- Next by Date: Re: Tough problem...
- Previous by thread: Re: Tough problem...
- Next by thread: Re: Tough problem...
- Index(es):
Relevant Pages
|