Re: need help with operations stability
From: Niels Dybdahl (ndy_at_fjern.detteesko-graphics.com)
Date: 03/02/05
- Next message: Nafai: "Re: Return pointer or variable by ref.?"
- Previous message: Karl Heinz Buchegger: "Re: Return pointer or variable by ref.?"
- In reply to: mihai: "need help with operations stability"
- Next in thread: Karl Heinz Buchegger: "Re: need help with operations stability"
- Reply: Karl Heinz Buchegger: "Re: need help with operations stability"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Nafai: "Re: Return pointer or variable by ref.?"
- Previous message: Karl Heinz Buchegger: "Re: Return pointer or variable by ref.?"
- In reply to: mihai: "need help with operations stability"
- Next in thread: Karl Heinz Buchegger: "Re: need help with operations stability"
- Reply: Karl Heinz Buchegger: "Re: need help with operations stability"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|