[HP35s] Fastest way to increment a variable
04-30-2019, 07:56 AM
Post: #5
 ijabbott Senior Member Posts: 1,130 Joined: Jul 2015
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
 « Next Oldest | Next Newest »

 Messages In This Thread [HP35s] Fastest way to increment a variable - fred_76 - 04-29-2019, 03:13 PM RE: [HP35s] Fastest way to increment a variable - Albert Chan - 04-29-2019, 06:18 PM RE: [HP35s] Fastest way to increment a variable - ijabbott - 04-30-2019 07:56 AM RE: [HP35s] Fastest way to increment a variable - fred_76 - 04-30-2019, 01:26 PM RE: [HP35s] Fastest way to increment a variable - Csaba Tizedes - 04-29-2019, 06:51 PM RE: [HP35s] Fastest way to increment a variable - grsbanks - 04-30-2019, 07:23 AM RE: [HP35s] Fastest way to increment a variable - Csaba Tizedes - 04-30-2019, 08:28 AM RE: [HP35s] Fastest way to increment a variable - fred_76 - 04-30-2019, 01:18 PM RE: [HP35s] Fastest way to increment a variable - burkhard - 04-30-2019, 01:49 PM

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