Re: setjmp/longjmp changed in Tiger
Re: setjmp/longjmp changed in Tiger
- Subject: Re: setjmp/longjmp changed in Tiger
- From: plumber <email@hidden>
- Date: Sun, 29 May 2005 19:47:46 +0200
/*************************************************************/
#include <stdio.h>
#include <fenv.h>
int main(void)
{
int save_rnd, rnd;
double x, y, z;
save_rnd = fegetround();
if (save_rnd == FE_TONEAREST)
printf("rounding direction is FE_TONEAREST\n");
else
printf("unexpected rounding direction\n");
x = 1.79e308;
y = 2.2e-308;
z = x / y; /* overflow */
printf("%g / %g = %g\n", x, y, z);
x = -1.79e308;
y = 2.2e-308;
z = x / y; /* negative overflow */
printf("%g / %g = %g\n", x, y, z);
fesetround(FE_TOWARDZERO);
rnd = fegetround();
if (rnd == FE_TOWARDZERO)
printf("rounding direction is FE_TOWARDZERO\n");
else
printf("unexpected rounding direction\n");
x = 1.79e308;
y = 2.2e-308;
z = x / y; /* overflow */
printf("%g / %g = %g\n", x, y, z);
fesetround(FE_UPWARD);
rnd = fegetround();
if (rnd == FE_UPWARD)
printf("rounding direction is FE_UPWARD\n");
else
printf("unexpected rounding direction\n");
/* continued */
/*************************************************************/
/*************************************************************/
x = -1.79e308;
y = 2.2e-308;
z = x / y; /* negative overflow */
printf("%g / %g = %g\n", x, y, z);
/* return to round-to-nearest */
fesetround(save_rnd);
rnd = fegetround();
if (rnd == FE_TONEAREST)
printf("rounding direction is FE_TONEAREST\n");
else
printf("unexpected rounding direction\n");
}
/*************************************************************/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden