----boundary-LibPST-iamunique-2123907780_-_-
Content-type: text/plain
Andrew
The code below LOOKs incorrect.
But maybe there is a kinder interpretation.
Bit 51 (ie bit 19 in the CONST below because of the 32-bit shift)
being set indicates a quiet nan, rather than a signalling nan.
So maybe this code recognises only quiet nans, and deliberately did not
bother with signalling nans which, presumably, should cause run-time
exceptions?
I really can't remember quite what I intended.
Cheers Robert
PS - why don't simple questions have simple answers?
>> Andrew
>>
>> My platform independent code ...
>>
>> CONST
>> nanS = {19 .. 30};
>>
>> PROCEDURE IsNan (x : REAL) : BOOLEAN;
>> VAR
>> xSet : SET;
>> BEGIN
>> xSet := SYSTEM.VAL (SET, SHORT (ASH (SYSTEM.VAL
>> (LONGINT, x), -32)));
>> RETURN nanS - xSet = {}
>> END IsNan;
>>
>> I neither guarantee it is BEST, or even correct. I haven't
>> used it for years.
>>
>> Cheers
>>
>> Robert
>>
>>
>> >> -----Original Message-----
>> >> From: blackbox{([at]})nowhere.xy>> Behalf Of A
>> >> Thomas
>> >> Sent: 13 August 2007 09:04
>> >> To: BlackBox Mailing List
>> >> Subject: [BlackBox] - testing for NaNs
>> >>
>> >> *** WARNING ***
>> >>
>> >> This mail has originated outside your organization,
>> either from an
>> >> external partner or the Global Internet.
>> >> Keep this in mind if you answer this message.
>> >>
>> >> Hei,
>> >>
>> >> I would like to test a REAL to see if it is a NaN. What
>> is the best
>> >> way of doing this? If I use a variant record I can regard
>> the 8 byte
>> >> real as two 4 byte integers (or maybe better two
>> variables of type
>> >> SET)But what bit pattern will indicate a NaN?
>> >>
>> >> Thanks
>> >>
>> >> Andrew
>> >>
>> >> --- BlackBox
>> >> --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy>> >>
>> >>
>> >>
>>
>> SELEX Sensors and Airborne Systems Limited Registered
>> Office: Sigma House, Christopher Martin Road, Basildon,
>> Essex SS14 3EL A company registered in England & Wales.
>> Company no. 02426132
>> ********************************************************************
>> This email and any attachments are confidential to the
>> intended recipient and may also be privileged. If you are
>> not the intended recipient please delete it from your system
>> and notify the sender.
>> You should not copy it or use it for any purpose nor
>> disclose or distribute its contents to any other person.
>> ********************************************************************
>>
>> --- BlackBox
>> --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy>>
>>
SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-2123907780_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIFxwYXINCkFuZHJld1xwYXINClxwYXINClRoZSBj
b2RlIGJlbG93IExPT0tzIGluY29ycmVjdC5ccGFyDQpccGFyDQpCdXQgbWF5YmUgdGhlcmUgaXMg
YSBraW5kZXIgaW50ZXJwcmV0YXRpb24uXHBhcg0KXHBhcg0KQml0IDUxIChpZSBiaXQgMTkgaW4g
dGhlIENPTlNUIGJlbG93IGJlY2F1c2Ugb2YgdGhlIDMyLWJpdCBzaGlmdClccGFyDQpiZWluZyBz
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INClRoaXMgZW1haWwgYW5kIGFueSBhdHRhY2htZW50cyBhcmUgY29uZmlkZW50aWFsIHRv
IHRoZSBpbnRlbmRlZFxwYXINCnJlY2lwaWVudCBhbmQgbWF5IGFsc28gYmUgcHJpdmlsZWdlZC4g
SWYgeW91IGFyZSBub3QgdGhlIGludGVuZGVkXHBhcg0KcmVjaXBpZW50IHBsZWFzZSBkZWxldGUg
aXQgZnJvbSB5b3VyIHN5c3RlbSBhbmQgbm90aWZ5IHRoZSBzZW5kZXIuXHBhcg0KWW91IHNob3Vs
ZCBub3QgY29weSBpdCBvciB1c2UgaXQgZm9yIGFueSBwdXJwb3NlIG5vciBkaXNjbG9zZSBvclxw
YXINCmRpc3RyaWJ1dGUgaXRzIGNvbnRlbnRzIHRvIGFueSBvdGhlciBwZXJzb24uXHBhcg0KKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq
KioqKioqKipccGFyDQpccGFyDQotLS0gQmxhY2tCb3hccGFyDQotLS0gc2VuZCBzdWJqZWN0IEhF
TFAgb3IgVU5TVUJTQ1JJQkUgdG8gYmxhY2tib3hAb2Jlcm9ufX0AaHRtbHRhZw=
----boundary-LibPST-iamunique-2123907780_-_---
Received on Mon Aug 13 2007 - 12:37:59 UTC