Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setjmp/longjmp changed in Tiger



/*************************************************************/
#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:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >setjmp/longjmp changed in Tiger (From: "David N. Williams" <email@hidden>)
 >Re: setjmp/longjmp changed in Tiger (From: Matt Watson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.