Re: setjmp/longjmp changed in Tiger
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com /*************************************************************/ #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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
plumber