From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA02435; Mon, 17 Jun 2002 18:10:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA02323; Mon, 17 Jun 2002 18:10:45 +0200 (MET DST) Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g5HGAi128700; Mon, 17 Jun 2002 18:10:44 +0200 (MET DST) Received: from dialup-64.156.201.174.dial1.sandiego1.level3.net ([64.156.201.174] helo=earthlink.net) by falcon.mail.pas.earthlink.net with esmtp (Exim 3.33 #2) id 17Jz5U-0003tc-00; Mon, 17 Jun 2002 09:10:40 -0700 Message-ID: <3D0E09FE.663C32D8@earthlink.net> Date: Mon, 17 Jun 2002 09:10:38 -0700 From: Ken Rose Reply-To: rose@acm.org X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: Xavier Leroy CC: Michael Vanier , gaurav_chanda@lycos.com, caml-list@pauillac.inria.fr Subject: Re: [Caml-list] Catching exceptions into strings References: <200206102157.g5ALvZg04810@orchestra.cs.caltech.edu> <20020612105308.B29875@pauillac.inria.fr> <200206120936.g5C9asB18950@orchestra.cs.caltech.edu> <20020617144811.B29486@pauillac.inria.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Xavier Leroy wrote: > > I tried this with java and was interested to find that integer > > division by zero is caught but floating point division by zero isn't. > > It is "caught" not as an exception, but by returning the appropriate > values defined for this very purpose in IEEE arithmetic: > 1.0 / 0.0 = +Inf -1.0 / 0.0 = -Inf 0.0 / 0.0 = NaN > This might not seem natural to you, but it's the result of years of > arguing among numerical experts, and is the standard towards which > both hardware and programming languages converge. I'm shooting from the hip here, having not even looked in the manual, but a good compromise might be some NaN-to-exception functions that are identity operations if the parameter is a regular number, but that raise exceptions if it's )for example) an infinity, or a NaN, or denormal, or perhaps others. - ken ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners