View previous topic :: View next topic |
Author |
Message |
MarkJordan
Joined: 18 Jan 2006 Posts: 11
|
Posted: Fri Dec 05, 2008 4:21 pm Post subject: ISHFT |
|
|
I have tried the following
INTEGER*1 i1Temp
i1Temp=-116
i1Temp=ISHFT(i1Temp,-1)
-116 should be 140 as an unsigned integer so I would expect 70 as the result (basically I am trying to do an unsigned divide by 2)
Compiled with Checkmate this comes up with the error arithmetic overflow
Compiled with Debug this doesn't throw up an error but it doesn't perform the operation.
Not sure why there is an error as a bit operation shouldn't result in arthmetic overflow?
Tried using RS instead of ISHFT and get the same result and error.
FTN95 version 5.10.0
Thanks
Mark Jordan |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8255 Location: Salford, UK
|
Posted: Fri Dec 05, 2008 4:46 pm Post subject: |
|
|
The help file says that you cannot use ISHFT in this way.
How about using positive INTEGER*2 values and then truncating to INTEGER*1? There are probably many other ways to do it. |
|
Back to top |
|
 |
MarkJordan
Joined: 18 Jan 2006 Posts: 11
|
Posted: Fri Dec 05, 2008 5:26 pm Post subject: |
|
|
Paul
Thanks - I missed that bit in the notes.
I have avoided INTEGER*2 as the source data is an unsigned INTEGER*1 binary file 14000 x 28000.
I have worked around the problem for now
Mark |
|
Back to top |
|
 |
|