I have a precision problem in C++. I have two angles which their average is pi/2 and they are like pi/2 +- alpha so the absolute values of sine and cosine should be equal. When I find their sine values in MATLAB they are equal, which they should be. Try out : sin(1.25911)
& sin(1.88252)
and their sum is 3.1416. But when I find these values in C++ the answer is : 0.951818 and 0.951806
How can I increase the accuracy of these numbers so the get equal? I can choose my precision up to 3 decimal numbers but I prefer to keep it up to 6.