Subject: Re: Floating Point Exceptions
To: Jon Buller <jonb@metronet.com>
From: Matthias Pfaller <leo@dachau.marco.de>
List: port-pc532
Date: 06/26/1995 09:55:52
> I was building Tcl7.3 in the past couple of weeks, and got it built just
> fine, but when running the self-tests, it fails in the eval tests by
> dumping core with a Floating Point Exception.  Testing a bit farther, I
> find that multiplying to relatively large numbers (to generate an Inf)
> and printing the result will cause a core, but just generating the value
> and moving it around is not a problem.  (gcc -S helps a lot with this one)

The problem is in lib/libc/arch/ns32k/gen/infinity.c. The byteorder of
the constant is wrong. But even if the byteorder would be right, it wouldn't
work. The only support the ns32381 gives for NaNs is to give you an exception
if you try to do anything with it (even loading it to a register).
I changed this constant to the largest possible double value some time ago,
but the change got lost I think.

> So, questions are: Does the 532 generate exceptions for overflows that are
> not turned into an Inf? Can the C library deal with such values without
> a core dump? Do I need to change my code to handle this properly? Should I
> put some effort into making the OS/lib deal with this properly?
>
> Any hints or suggestions (or even requests for help)?

You could do a traphandler that can handle NaNs... Or you could change
infinity.c to not use a NaN.

	Matthias