Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Ada > Re: How to chec...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 20 of 35 Topic 5676 of 5831
Post > Topic >>

Re: How to check a Float for NaN

by anon@[EMAIL PROTECTED] (anon) May 10, 2008 at 05:00 PM

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.

And because float is normally defined by the IEEE-754 as a 32-bit 
number it will fix into a 64-bit integer without raising a 
Constraint_Error.  The size of Long_Long_Integer is at least 64-bit 
signed integer on a 32/64 bit machines.

NaN := range 2#0111_1111_1111_0000_0000_0000_0000_0000# 
               ..
               2#1111_1111_1111_1111_1111_1111_1111_1111#  ;


In <12227360.svS57WvVVs@[EMAIL PROTECTED]
>, Martin Krischik
<krischik@[EMAIL PROTECTED]
> writes:
>Jerry wrote:
>
>> How would one check a Float or Long_Float if it has value NaN? The
>> only ways that I can come up with are to im****t a C function (isnan, I
>> think) or to write Long_Float'image(Some_Float) to a string and
>> examine the first three characters to see if they are "NaN" (and that
>> seems to be a GNAT implementation choice so might not be ****table,
>> which is OK for my use).
>
>How about an Unchecked Conversion to an Unsigned_64 and comparing
>>2#0111_1111_1111_0000_0000_0000_0000_0000#
>
>Note that it's '>' as 2#0111_1111_1111_0000_0000_0000_0000_0000# is
positive
>infinity.
>
>Martin
>-- 
>mailto://krischik@[EMAIL PROTECTED]
>Ada programming at: http://ada.krischik.com
 




 35 Posts in Topic:
How to check a Float for NaN
Jerry <lanceboyle@[EMA  2008-04-30 03:27:51 
Re: How to check a Float for NaN
christoph.grein@[EMAIL PR  2008-04-30 03:47:54 
Re: How to check a Float for NaN
christoph.grein@[EMAIL PR  2008-04-30 03:50:15 
Re: How to check a Float for NaN
Adam Beneschan <adam@[  2008-04-30 08:02:05 
Re: How to check a Float for NaN
"Randy Brukardt"  2008-04-30 18:29:14 
Re: How to check a Float for NaN
"Stuart" <st  2008-05-01 09:04:11 
Re: How to check a Float for NaN
Jerry <lanceboyle@[EMA  2008-04-30 13:33:17 
Re: How to check a Float for NaN
Jerry <lanceboyle@[EMA  2008-04-30 13:36:21 
Re: How to check a Float for NaN
Adam Beneschan <adam@[  2008-04-30 14:53:54 
Re: How to check a Float for NaN
Adam Beneschan <adam@[  2008-04-30 16:23:13 
Re: How to check a Float for NaN
Adam Beneschan <adam@[  2008-04-30 18:00:21 
Re: How to check a Float for NaN
Keith Thompson <kst-u@  2008-05-01 12:52:16 
Re: How to check a Float for NaN
Jerry <lanceboyle@[EMA  2008-04-30 18:05:41 
Re: How to check a Float for NaN
Adam Beneschan <adam@[  2008-05-01 07:38:40 
Re: How to check a Float for NaN
"Stuart" <st  2008-05-01 18:14:09 
Re: How to check a Float for NaN
"Randy Brukardt"  2008-05-01 14:22:35 
Re: How to check a Float for NaN
Jerry <lanceboyle@[EMA  2008-05-01 16:57:26 
Re: How to check a Float for NaN
Jerry <lanceboyle@[EMA  2008-05-01 17:04:53 
Re: How to check a Float for NaN
Martin Krischik <krisc  2008-05-05 20:23:02 
Re: How to check a Float for NaN
anon@[EMAIL PROTECTED] (  2008-05-10 17:00:51 
Re: How to check a Float for NaN
Keith Thompson <kst-u@  2008-05-11 15:00:55 
Re: How to check a Float for NaN
anon@[EMAIL PROTECTED] (  2008-05-12 02:01:18 
Re: How to check a Float for NaN
Adam Beneschan <adam@[  2008-05-05 13:49:25 
Re: How to check a Float for NaN
Jerry <lanceboyle@[EMA  2008-05-06 11:09:56 
Re: How to check a Float for NaN
"Wiljan Derks"   2008-05-06 20:45:47 
Re: How to check a Float for NaN
Adam Beneschan <adam@[  2008-05-06 15:18:39 
Re: How to check a Float for NaN
"Randy Brukardt"  2008-05-07 17:56:57 
Re: How to check a Float for NaN
Stephen Leake <Stephe.  2008-05-09 03:24:21 
Re: How to check a Float for NaN
"Randy Brukardt"  2008-05-07 17:56:57 
Re: How to check a Float for NaN
Adam Beneschan <adam@[  2008-05-07 16:20:55 
Re: How to check a Float for NaN
anon@[EMAIL PROTECTED] (  2008-05-09 19:49:50 
Re: How to check a Float for NaN
Jerry <lanceboyle@[EMA  2008-05-09 19:36:58 
Re: How to check a Float for NaN
anon@[EMAIL PROTECTED] (  2008-05-10 03:53:54 
Re: How to check a Float for NaN
Georg Bauhaus <see.rep  2008-05-10 10:05:33 
Re: How to check a Float for NaN
christoph.grein@[EMAIL PR  2008-05-09 23:24:48 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 20:45:57 CDT 2008.