In <17751.927941...@zippy.cdrom.com>, Jordan K. Hubbard wrote: 
[...]
> JFYI - don't want us getting *too* complacent with -current now, do we? :-)

Floating point exceptions are also broken, they always behave like
masked, even if you unmask some explicitly with fpsetmask().

Even worse, a wrong result is returned if an exception had to be
thrown, while the result is right for masked exceptions.

#include <stdio.h>
#include <stdlib.h>
#include <machine/floatingpoint.h>

int main(void)
{
  fpsetmask(0);
  fprintf(stderr, "I want no exception, but an exception value\n");
  fprintf(stderr, "res: %g\n", atof("1.0") / atof("0.0"));

  fpsetmask(FP_X_INV|FP_X_DNML|FP_X_DZ|FP_X_OFL|FP_X_UFL);
  fprintf(stderr, "I want an exception. Or at least an exceptional value\n");
  fprintf(stderr, "res: %g\n", atof("1.0") / atof("0.0"));
  fprintf(stderr, "I didn't get one!\n");
  return 0;
}

output on -current:
  I want no exception, but an exception value
  res: Inf
  I want an exception. Or at least an exception value
  res: 1
  I didn't get one!

output on anything else:
  I want no exception, but an exception value
  res: Inf
  I want an exception. Or at least an exception value
  Floating point exception (core dumped)

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <craca...@cons.org> http://www.cons.org/cracauer/
  Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536


To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message

Reply via email to