Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jan 2000 09:36:59 -0500 (EST)
From:      Kelly Yancey <kbyanc@posi.net>
To:        Martin Cracauer <cracauer@cons.org>
Cc:        Markus Holmberg <saska@acc.umu.se>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Should -mieee-fp equal fpsetmask(0) to avoid SIGFPE on FreeBSD?
Message-ID:  <Pine.BSF.4.05.10001040934070.32954-100000@kronos.alcnet.com>
In-Reply-To: <20000104121459.A8959@cons.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> #include <stdio.h>
> #include <limits.h>
> #include <floatingpoint.h>
> 
> int main(void)
> {
>   double bla;
>   int foo;
> 
>   fpsetmask(0);
>   bla = (double)INT_MAX + 1.0;
>   foo = bla;
> 
>   printf("Result: %d\n", foo);
> 
>   return 0;
> }
> 
> Result: -2147483648
> 
> 

  Actually, this the same value (INT_MIN = -2147483648) you would get if
you just said foo = INT_MAX + 1 since in 2's complement notation INT_MIN =
INT_MAX + 1. It definately isn't garbage. Nonetheless, your point is
valid, floating point exceptions do exist for a purpose.

  Kelly

--
Kelly Yancey  -  kbyanc@posi.net  -  Richmond, VA
Analyst / E-business Development, Bell Industries  http://www.bellind.com/
Maintainer, BSD Driver Database       http://www.posi.net/freebsd/drivers/
Coordinator, Team FreeBSD        http://www.posi.net/freebsd/Team-FreeBSD/



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.10001040934070.32954-100000>