Long Double Calculation on Intel
Long Double Calculation on Intel
- Subject: Long Double Calculation on Intel
- From: Richard Somers <email@hidden>
- Date: Tue, 9 Oct 2007 10:00:17 -0600
Below is a small program which calculates the cosine of 45 degrees in
double and long double precision. The result should be 0.707...
It works fine on PowerPC but the Intel long double produces garbage.
Does anyone know what is happening here?
I know the PowerPC long double precision is 128 bits and the Intel
long double precision is 80 bits. But it still should work.
#include <stdio.h>
#include <math.h>
int main ()
{
double result1 = cos(45.0 * M_PI / 180.0);
printf("cos 45 degrees .14e\n", result1);
long double result2 = cosl(45.0 * M_PI / 180.0);
printf("cosl 45 degrees .14e\n", result2);
return 0;
}
PowerPC Output
cos 45 degrees 7.07106781186547e-01
cosl 45 degrees 7.07106781186548e-01
Intel Output
cos 45 degrees 7.07106781186548e-01
cosl 45 degrees -2.73410411748968e-53
Regards, Richard
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden