From owner-freebsd-hackers Sat Oct 3 13:07:58 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA22393 for freebsd-hackers-outgoing; Sat, 3 Oct 1998 13:07:58 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from picnic.mat.net (picnic.mat.net [206.246.122.117]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA22387 for ; Sat, 3 Oct 1998 13:07:52 -0700 (PDT) (envelope-from chuckr@mat.net) Received: from localhost (chuckr@localhost) by picnic.mat.net (8.9.1/8.8.5) with SMTP id QAA13868; Sat, 3 Oct 1998 16:07:11 -0400 (EDT) Date: Sat, 3 Oct 1998 16:07:11 -0400 (EDT) From: Chuck Robey To: Dan Strick cc: freebsd-hackers@FreeBSD.ORG Subject: Re: IEEE floating point arithmetic In-Reply-To: <199810031853.LAA04652@math.berkeley.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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