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,772ddcb41cd06d5b X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: How to check a Float for NaN Reply-To: anon@anon.org (anon) References: <3132e38d-18bb-4890-9cec-31056ac6e3ba@x19g2000prg.googlegroups.com> <12227360.svS57WvVVs@linux1.krischik.com> <7xkVj.184851$D_3.118604@bgtnsc05-news.ops.worldnet.att.net> <87wsm0o608.fsf@kvetch.smov.org> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Mon, 12 May 2008 02:01:18 GMT NNTP-Posting-Host: 12.64.84.36 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1210557678 12.64.84.36 (Mon, 12 May 2008 02:01:18 GMT) NNTP-Posting-Date: Mon, 12 May 2008 02:01:18 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:45 Date: 2008-05-12T02:01:18+00:00 List-Id: If you read I answered that! >> In order to save coding time, did not want to add the >> extra statements. Plus, if it for a final (it that time of the year) they >> should be able add those lines. Last week was FINALS WEEK for most colleges. If you answer a question durring this time you NEVER give the complete answer only a partial one. And it does not matter if the answer is in code or a couple of paragraphs. My answer was just that, correct in the outline but not is uncomplete. And any Ada programmer should be able to take my program and make it work within a minute or two. But a college student at finals would never spend the time, they want the complete and only complete answer, so they can study for other classes or party. n <87wsm0o608.fsf@kvetch.smov.org>, Keith Thompson writes: >anon@anon.org (anon) writes: >> If you look at my first post on this topic and change the 16#FF000000# >> to 16#7F000000# (typo, forgot to adjust for the sign-bit) its basically >> what I have done except that I use a 64-bit sign integer instead of the >> Unsigned_64. In order to save coding time, did not want to add the >> extra statements. Plus, if it for a final (it that time of the year) they >> should be able add those lines. >[...] > >You're using a value conversion. This converts, for example, the >Float value 3.0 to the Long_Long_Integer value 3. In your code, with >16#FF000000# changed to 16#7F000000#, this: > > T : Long_Long_Integer := Long_Long_Integer ( N ) ; > ... > if T > 16#7F000000# then > ... > >is essentially equivalent to this: > > if T > 2130706432.0 then > >Try isNan(2.0E9) and isNan(3.0E9). > >You need an Unchecked_Conversion. You also need to make sure you >choose a floating-point and integer type of the same size, and to >allow for things like byte ordering (even if you're limiting the test >to systems that support IEEE floating-point, which is probably a >reasonable restriction since other floating-point formats may not >support NaNs at all). > >-- >Keith Thompson (The_Other_Keith) >Nokia >"We must do something. This is something. Therefore, we must do this." > -- Antony Jay and Jonathan Lynn, "Yes Minister"