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!goblin1!goblin.stu.neva.ru!news.musoftware.de!wum.musoftware.de!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool4.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: <1tbp3geoa5yna$.171cmlfdrbm98$.dlg@40tude.net> Date: Sat, 17 Jul 2010 09:40:23 +0200 Message-ID: <5xj0ja9xywto$.3ncqua6onpoa.dlg@40tude.net> NNTP-Posting-Date: 17 Jul 2010 09:40:23 CEST NNTP-Posting-Host: efa5c2e0.newsspool4.arcor-online.net X-Trace: DXC=Q?D9WS7iGoi]BlmkiiU@Bi4IUK67Cdc?2d[6LHn;2LCVn[ On Fri, 16 Jul 2010 22:35:14 +0000 (UTC), Warren wrote: > I'll need > to test it on other platforms, but hopefully most if not all > IEEE platforms will support this. IEEE representations have more than +Inf, -Inf and NaN. There are other objects: +0, -0, denormalized numbers (see attribute 'Denorm). Some have dubious semantics: with Ada.Text_IO; use Ada.Text_IO; procedure IEEE_Zeros is Zero : Float := 0.0; N0 : Float := 0.0 / (-1.0 / Zero); begin Put_Line ("-0 =" & Float'Image (N0) & " 0 = " & Float'Image (Zero)); Put_Line ("-0 = 0 " & Boolean'Image (N0 = Zero)); Put_Line ("-0 < 0 " & Boolean'Image (N0 < Zero)); end IEEE_Zeros; Negative zero is zero but not equal to, etc. What are you trying to achieve? Because in automation we have the rule never ever let IEEE cripples slip through. Don't read them, don't write them, don't compute them. The solution Simon suggested is basically everything Ada programmer should know about IEEE 754! (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de