Re: need help with operations stability

From: Niels Dybdahl (ndy_at_fjern.detteesko-graphics.com)
Date: 03/02/05


Date: Wed, 2 Mar 2005 15:36:58 +0100


> I must write a C++ program for my computational geometry class,
> and I need some references where can I solve the next problem:
>
> POINT P(1, 0);
>
> for (i=0;i<96;++i)
> P.rotate(PI/2);
>
> Now P must be at (1, 0) ...
> but it isn't ...

Maybe your PI/2 constant is wrong. Check if sin(PI/2)==1 and cos(PI/2)==0.
If they are, then you have an error in the rotate function. If not then
either PI/2 is wrong or your sin and cos functions are wrong. I have heard
that sin and cos implemented in the intel processors FPU are a little bit
wrong (thats why Java does not use the trig. functions in the FPU, but uses
its own), so that might be the cause.

However in general it is better not to rely on float/double calculations
being precise.

Niels Dybdahl



Relevant Pages

  • 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: Parametric plot with a data file instead of functions.
    ... my sin and cos functions come from a 3-column data file. ... I am not quite sure what you mean by "sin and cos functions come from ... If you want to plot the cos of column 2 versus the sin of column one, ...
    (comp.graphics.apps.gnuplot)
  • Re: Combining Functions
    ... request, I have got to the part where i have to program the equations ... and i cant seem to get them to link together. ... enters his radians i was to link to a sin x function to calculate the ... There should be no need to program sin and cos functions yourself. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Tough problem...
    ... The sin and cos functions become inaccurate when ... I'm no expert here, and I dont quite get where the i comes from, but ...
    (borland.public.delphi.language.basm)