Re: [BLACKBOX] Type transfer

From: [at]} <Robert>
Date: Fri, 14 Oct 2011 22:57:00 +0100


Thanks for the suggestions.

Since the language includes the ENTIER function I just assumed that it would
have its inverse. Apparently not.


I don't want an ASSERT to indicate a problem is about to occur, I want to solve
the problem.

To this effect I have written a short (0 byte !) in-line assembler function that
does what I want - see the attached.


Doing nothing causes an overflow without any warning - not what I want here.

The expression "(n + 0.)" works as I want, but the expression "Float (n)" just
looks more natural (and efficient!) to me.



Regards

Robert


On 14/10/2011 02:09 PM, Rene A. Krywult wrote:
> r:=n;
> r:=r*r;
> And if you fear overflow, you should ASSERT against it, I believe.
>
> Rene
> -------- Original-Nachricht --------
>> Datum: Fri, 14 Oct 2011 13:26:18 +0100
>> Von: Robert<robert.campbell_{([at]})nowhere.xy
>> An: BLACKBOX{([at]})nowhere.xy
>> Betreff: Re: [BLACKBOX] Type transfer

>> Yes, but ....
>>

>> What I want to do is
>>
>> r := n * n
>>
>> and if I don't convert before the assignment I risk overflow.
>>
>> Cheers
>>
>> Robert
>>
>>
>> On 14/10/2011 12:30 PM, Rene A. Krywult wrote:
>>> MODULE PrivConv;
>>> VAR r:REAL; n:INTEGER;
>>> BEGIN
>>> n:=5;
>>> r:=n;
>>> END PrivConv.
>>>
>>> -------- Original-Nachricht --------

>>>> Datum: Fri, 14 Oct 2011 12:23:29 +0100
>>>> Von: "Campbell, Robert (SELEX GALILEO,
>> UK)"<robert.d.campbell{([at]})nowhere.xy
>>>> An: BLACKBOX{([at]})nowhere.xy
>>>> Betreff: [BLACKBOX] Type transfer
>>>> My mind has suddenly gone blank!

>>>>
>>>>
>>>> What is the easiest way of converting an INTEGER (say n) to a REAL?
>>>>
>>>> The expression "(n + 0.)" just seems a bit unnatural.
>>>>
>>>>
>>>> Cheers
>>>>
>>>> Robert
>>>> SELEX Galileo Ltd
>>>> 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
>>
>> ----
>> To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to
>> LISTSERV{([at]})nowhere.xy


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy






Received on Fri Oct 14 2011 - 23:57:00 UTC

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