Date: Sat, 3 Oct 1998 16:07:11 -0400 (EDT) From: Chuck Robey <chuckr@mat.net> To: Dan Strick <dan@math.berkeley.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: IEEE floating point arithmetic Message-ID: <Pine.BSF.4.02A.9810031600340.362-100000@picnic.mat.net> In-Reply-To: <199810031853.LAA04652@math.berkeley.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 3 Oct 1998, Dan Strick wrote: > I am under the impression that the FreeBSD (gnu) C-compiler does > IEEE 754 compatible floating poing arithmetic and that this means > that floating point operations like (1.0 / 0.0) should return a > special value that means +infinity. What I get is a core dump. > Am I supposed to include some special math library or give some > special cc command option? You're nearly right, but there's a little more paperwork to do here. Read the 'math' man page, and see how exceptions control how the mathwork is done, and then read the fpgetmask/fpsetmask man page to show you how to set up the exceptions. If you mask the problems you want reported to you, and set up special routines (via signal handlers) to take action when you _do_ want to do something special, then stuff'll work just fine for you. I just noticed that my favorite guru book, Stevens' Advanced Programming In The Unix Environment hasn't a word about fp stuff, but it has lots on setting up signal handlers, and the math man page, together with the other one, probably will be sufficient. If you still need examples, if it were me, I'd get the sources for the octave port, and read those, which have all you could ask for as far as math. ----------------------------+----------------------------------------------- Chuck Robey | Interests include any kind of voice or data chuckr@glue.umd.edu | communications topic, C programming, and Unix. 213 Lakeside Drive Apt T-1 | Greenbelt, MD 20770 | I run Journey2 and picnic (FreeBSD-current) (301) 220-2114 | and jaunt (NetBSD). ----------------------------+----------------------------------------------- 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.02A.9810031600340.362-100000>