From: anon@anon.org (anon)
Subject: Re: How to check a Float for NaN
Date: Sat, 10 May 2008 03:53:54 GMT
Date: 2008-05-10T03:53:54+00:00 [thread overview]
Message-ID: <m%8Vj.182522$D_3.92732@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: b42cb056-f923-45d9-9e01-d46d8376c41b@t12g2000prg.googlegroups.com
Reference Microsoft and
"isnan.asm" from
http://www.visionlab.uncc.edu/websvn/filedetails.php?repname=toolchain&path=%2Fvendor%2Fvdsplibs%2Fcurrent%2Flibdsp%2Fisnan.asm&rev=1693&sc=1
The only mistake is that T > 16#7F000000# because I forgot to adjust
for the the sign bit because NaN can have a valid sign set.
This work because in Intel the NaN is set by forcing bits 30-24 to 1 aka
16#7F000000#
The
T : Long_Long_Integer := Long_Long_Integer ( N ) ;
moves the bit-value of N a 48-bit float to a Long_Long_Integer (T)
without conversion.
In <b42cb056-f923-45d9-9e01-d46d8376c41b@t12g2000prg.googlegroups.com>, Jerry <lanceboyle@qwest.net> writes:
>On May 9, 12:49=A0pm, a...@anon.org (anon) wrote:
>> =A0 --
>> =A0 -- Nan is define to be greater than value of hex 16#FF000000#
>> =A0 --
>>
>> =A0 function isNan ( N : Float ) return Boolean is
>>
>> =A0 =A0 =A0T : Long_Long_Integer :=3D Long_Long_Integer ( N ) ;
>>
>> =A0 =A0 begin
>> =A0 =A0 =A0 if T > 16#FF000000# then
>> =A0 =A0 =A0 =A0 return True ;
>> =A0 =A0 =A0 else
>> =A0 =A0 =A0 =A0 return False ;
>> =A0 =A0 =A0 end if ;
>> =A0 =A0 end ;
>>
>> In <3132e38d-18bb-4890-9cec-31056ac6e...@x19g2000prg.googlegroups.com>, Je=
>rry <lancebo...@qwest.net> writes:
>>
>> >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 import 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 portable,
>> >which is OK for my use).
>>
>> >Jerry
>
>No offense to anon, but does this work? Does anyone know of a
>reference for this definition of a NaN?
>
>Also, wondering how one might detect an Inf.
>
>It seems that there is enough information in this thread to begin
>writing a little package to deal with some of these things.
>
>Thanks for all the great tips, BTW.
>
>Jerry
next prev parent reply other threads:[~2008-05-10 3:53 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-30 10:27 How to check a Float for NaN Jerry
2008-04-30 10:47 ` christoph.grein
2008-04-30 10:50 ` christoph.grein
2008-04-30 15:02 ` Adam Beneschan
2008-04-30 20:33 ` Jerry
2008-04-30 23:23 ` Adam Beneschan
2008-05-01 1:00 ` Adam Beneschan
2008-05-01 19:52 ` Keith Thompson
2008-05-01 23:57 ` Jerry
2008-04-30 23:29 ` Randy Brukardt
2008-05-01 8:04 ` Stuart
2008-05-01 14:38 ` Adam Beneschan
2008-05-01 17:14 ` Stuart
2008-05-01 19:22 ` Randy Brukardt
2008-05-02 0:04 ` Jerry
2008-04-30 20:36 ` Jerry
2008-04-30 21:53 ` Adam Beneschan
2008-05-01 1:05 ` Jerry
2014-05-22 7:27 ` jan.de.kruyf
2014-05-22 8:09 ` Dmitry A. Kazakov
2014-05-22 9:24 ` Simon Wright
2014-05-22 9:48 ` Dmitry A. Kazakov
2014-05-22 15:28 ` Adam Beneschan
2014-05-22 16:31 ` Dmitry A. Kazakov
2014-05-22 23:33 ` Adam Beneschan
2014-05-23 7:38 ` Dmitry A. Kazakov
2014-05-23 21:39 ` Randy Brukardt
2014-05-27 8:35 ` Dmitry A. Kazakov
2014-05-27 12:35 ` Maurizio Tomasi
2014-05-27 15:53 ` Adam Beneschan
2014-05-27 22:35 ` Randy Brukardt
2014-05-27 22:59 ` Jeffrey Carter
2014-05-28 7:32 ` Dmitry A. Kazakov
2014-05-28 8:40 ` Maurizio Tomasi
2008-05-05 18:23 ` Martin Krischik
2008-05-05 20:49 ` Adam Beneschan
2008-05-06 18:09 ` Jerry
2008-05-06 18:45 ` Wiljan Derks
2008-05-06 22:18 ` Adam Beneschan
2008-05-07 22:56 ` Randy Brukardt
2008-05-07 22:56 ` Randy Brukardt
2008-05-07 23:20 ` Adam Beneschan
2008-05-09 7:24 ` Stephen Leake
2008-05-10 17:00 ` anon
2008-05-11 22:00 ` Keith Thompson
2008-05-12 2:01 ` anon
2008-05-09 19:49 ` anon
2008-05-10 2:36 ` Jerry
2008-05-10 3:53 ` anon [this message]
2008-05-10 6:24 ` christoph.grein
2008-05-10 8:05 ` Georg Bauhaus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox