English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Catching exceptions into strings
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-06-17 (16:10)
From: Ken Rose <kenarose@e...>
Subject: Re: [Caml-list] Catching exceptions into strings
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