From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e01fe1b326df26d4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.stueberl.de!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Division by zero Date: Sun, 12 Jun 2005 18:38:15 +0100 Organization: Pushface Message-ID: References: <5sana1pm436l6vboifijqblu0irf84afkr@4ax.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1118597896 4031 62.49.19.209 (12 Jun 2005 17:38:16 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sun, 12 Jun 2005 17:38:16 +0000 (UTC) Cancel-Lock: sha1:m9ufQVXZS3+2WUH/6hNaORxJp3A= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Xref: g2news1.google.com comp.lang.ada:11301 Date: 2005-06-12T18:38:15+01:00 List-Id: Dennis Lee Bieber writes: > On Sun, 12 Jun 2005 15:04:17 +1200, "Lurker" > declaimed the following in comp.lang.ada: > > >> >> It was. My question was - should it have been caught >> at compile time instead? >> > Possibly not... Isn't 0/0 allowed in IEEE -> giving one of those > strange NaN type results... These are integers, though, and GNAT catches integer divide-by-zero. For floats, you can either check 'Valid (Infs and NaNs aren't) or use a constrained subtype: type My_Float is Float range Float'First .. Float'Last; which will give you the constraint error you'd expect when you assign an invalid result to it. Well, come to think I didn't try with NaN ...