Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Does the BASIC Stamp handle signed numbers and arithmetic?

0
10 Posted

Does the BASIC Stamp handle signed numbers and arithmetic?

0
10

Yes. The BASIC Stamp uses twos-compliment notation for signed numbers. This means that the expression: 0 -10 + 5 will result in -5 if viewed as a signed number, however, most instructions see the number as a positive value, in this case 65531 (the twos-compliment value for -5). All mathematical operators, except division, will work properly with signed numbers in the BASIC Stamp and signed numbers can be formatted for output properly using the SDEC, SHEX and SBIN formatters within DEBUG and SEROUT statements on the BASIC Stamp II. Be careful how you use signed numbers elsewhere.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123