Date: Sat, 29 May 1999 14:13:18 +0200 From: Martin Cracauer <cracauer@cons.org> To: "Jordan K. Hubbard" <jkh@zippy.cdrom.com> Cc: current@FreeBSD.ORG Subject: FP exceptions broken (Re: Interesting bogons from last night's 4.0 snapshot.) Message-ID: <19990529141318.A4777@cons.org> In-Reply-To: <17751.927941299@zippy.cdrom.com>; from Jordan K. Hubbard on Fri, May 28, 1999 at 06:28:19PM -0700 References: <17751.927941299@zippy.cdrom.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In <17751.927941299@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 <cracauer@cons.org> http://www.cons.org/cracauer/
Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990529141318.A4777>
