Post Reply 
[HP35s] Fastest way to increment a variable
04-30-2019, 07:56 AM
Post: #5
RE: [HP35s] Fastest way to increment a variable
(04-29-2019 06:18 PM)Albert Chan Wrote:  
(04-29-2019 03:13 PM)fred_76 Wrote:  The unexpected and quite fast one :
Code:

RCL V
NOT
+/-
STO V
=> only takes 22 ms (1.7x faster) but 4 lines of code, and only works with integers

Is NOT the bitwise negation operator ? (instead of logical NOT, returning 0, 1)

Yes, 36-bit bitwise negation.

Quote:What range of integers until above not work anymore ? Some 2^n powers ?

2's complement range [-(2^35), 2^35-1].

Quote:If the order NOT +/- is switched, does it decrement the number ?

Yes. E.g.: "0 +/- NOT" produces -1.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [HP35s] Fastest way to increment a variable - ijabbott - 04-30-2019 07:56 AM



User(s) browsing this thread: 1 Guest(s)