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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,23a8a20ef7e9405e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!feeder.erje.net!news2.arglkargh.de!noris.net!newsfeed.velia.net!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: S'Is_nan or S'Is_inf? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Fri, 16 Jul 2010 10:42:38 +0200 Message-ID: <1tbp3geoa5yna$.171cmlfdrbm98$.dlg@40tude.net> NNTP-Posting-Date: 16 Jul 2010 10:42:38 CEST NNTP-Posting-Host: ab8c6343.newsspool4.arcor-online.net X-Trace: DXC=Ni6IFG;ER8T1`E>oC;JXEZ4IUK On Thu, 15 Jul 2010 23:07:51 +0100, Simon Wright wrote: > Warren writes: > >> Is there any is not-a-number or is-infinity test support in Ada05+ >> (for floats)? Is there any being planned? with Ada.Text_IO; use Ada.Text_IO; procedure IEEE is -- Only if Float is IEEE! Zero : Float := 0.0; Inf : Float := 1.0 / Zero; NaN : Float := 0.0 / Zero; begin Put_Line ("Valid " & Boolean'Image (Inf'Valid)); Put_Line ("In range " & Boolean'Image (Inf <= Float'Last)); Put_Line ("Self NaN " & Boolean'Image (NaN = NaN)); end IEEE; On an IEEE machine it could print 3x FALSE. > With GNAT, using a subtype > > subtype Checked_Float is Float range Float'Range; > > will give you a Constraint_Error for NaN or +/-Inf. Yes, one of the reasons not to use built-in types is that the floating point ones most likely are IEEE with all nasty consequences. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de