Re: [BLACKBOX] Another (?) Compiler Trap

From: Campbell, Robert (SELEX GALILEO, UK) <"Campbell,>
Date: Mon, 3 Mar 2008 10:22:30 -0000

----boundary-LibPST-iamunique-2118894617_-_-
Content-type: text/plain

Hi

By total coincidence I came across another (possibly the same)
compiler TRAP this morning:

VAR
  x, z : REAL
  exp : INTEGER;
BEGIN
  z := ABS (x);
  exp := SHORT (ASH (SYSTEM.VAL (LONGINT, z), -52)) - 1023;


The code above works ok, but if I one-line it by replacing z by 'ABS
(x)' I get TRAP 0.



This code is an attempt to extract the exponent of a floating point
number.
I know that Math.Exponent already provides this function, but I am
trying to
get a version that will also run under the Gardens Point compiler.

The code above is NOT transportable because it uses SYSTEM.VAL. Chris,
if you are
listening, is there a Gardens Point way of type casting REALs to
LONGINTs without
changing the bit patterns?


Thanks

Robert

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.
********************************************************************


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-2118894617_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpc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ioqKioqKioqKioqKioqKioqKioqKlxwYXINClxwYXINClxwYXINCi0tLS1ccGFy
DQpUbyB1bnN1YnNjcmliZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNL
Qk9YIiB0byBMSVNUU0VSVkBMSVNUUy5PQkVST04uQ0h9fQArfwAA
----boundary-LibPST-iamunique-2118894617_-_---
Received on Mon Mar 03 2008 - 11:22:30 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:59 UTC