BBC BASIC for Windows
« *HEX64 is useful... »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: *HEX64 is useful...  (Read 357 times)
DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx *HEX64 is useful...
« Thread started on: Jul 31st, 2015, 08:35am »

Just a note about something that caught me out, and might help others...

If you use the new 64 bit integers, (for example, bigint%%), some operation may not work as you expect if you forget to issue a *HEX64 command first!

Examples:
Code:
bigint%%=&FFFFFFFF 
 

will set bigint%% to -1, while
Code:
*HEX64
bigint%%=&FFFFFFFF 
 

will (correctly) set it to 4294967295.

The one that got me was that PRINT ~bigint%% (print in hexadecimal format) wasn't working as I expected - effectively truncating it to a 32 bit number.

When you know what the problem is, the manual makes it all clear:

"
*HEX
...
Control whether the hexadecimal conversion (& and ~) and bit-shift (<< and >>) operators treat their operands as 32-bit or 64-bit integers. In the (default) *HEX 32 mode the operators work in a fashion which is compatible with earlier versions of BBC BASIC; the operands are treated as 32-bit signed integers. In *HEX 64 mode the operands are treated as 64-bit signed integers. "

Best wishes,

D
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls