xrpn 2.7 → 2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e1070cc4a730b8515e905da3e7f6df2158698bbf40c38d00ceecd46980ba9f2
4
- data.tar.gz: 333db30ef26238289797412260f964d1c164f93a36d5035c7c75ce649ab70d84
3
+ metadata.gz: 227fdefaae8453dcf1ae2a78f78e553d8cd4e815ee4d5091626f4a92135714f9
4
+ data.tar.gz: a2e80c27d0193de2f5b3ee7d24958f1bfe70f7a8819c8a1a0e9d54a3e61efb84
5
5
  SHA512:
6
- metadata.gz: 3b60f0ec411635585d76bd30e0b3e989ad04202d577f166fcc537b6f0a1fc1594ea3b3b5681d1a6f5a9c4ea8db4367936ac04a7dc0ef24f914c33ebb3a9edc89
7
- data.tar.gz: e884ac9757c49cf35854d2f153254e7f7c245424ef4e0712ba1afd16b5dae5b247838ec1e5bf5c983629146954b6747cc74aadcf4f17f20918316aeec9a89815
6
+ metadata.gz: 409299fdc536bffb61dc142ec74cec2ab5ef4895d096103b8d9029dc191fcb23955bdb7b371a9ddf96958ea2f71731bd4b93a4cbcfba6436e023e967e166d506
7
+ data.tar.gz: 900b051ab8436b0b4ae78bc189b33cf4cbf55ad1ab1f6a11134cee4bd7204a5315b10c4aee9cd99919563dba84d85db4291541a2679023c04a71e5e54d032361
data/README.md CHANGED
@@ -120,7 +120,14 @@ See `raw.md` for complete technical documentation.
120
120
 
121
121
  ## Changelog
122
122
 
123
- ### Version 2.7 (Latest)
123
+ ### Version 2.8 (Latest)
124
+ **ISG / control-number fixes**
125
+
126
+ - **ISG now increments** — `ISG` ("Increment, Skip if Greater") was decrementing the counter (DSE's behaviour), so count-up loops ran backwards. It now increments and skips the next step when the counter exceeds the end value.
127
+ - **Robust control-number decode** — the `ccc.fffii` decode (`x2bei`) now scales by 100000 and rounds once, so binary-float dust no longer mis-reads controls like `1.003` (previously decoded with end=2 instead of 3).
128
+ - The same corrected semantics ship in the nomad mobile XRPN calculator.
129
+
130
+ ### Version 2.7
124
131
  **HP-41 RAW Import/Export - 100% Success!**
125
132
 
126
133
  - **Complete HP-41 RAW import/export** - RAWIMPORT and RAWEXPORT commands with 100% decode rate on real HP-41 programs
data/xcmd/isg CHANGED
@@ -18,7 +18,7 @@ class XRPN
18
18
  b, e, i = x2bei(c)
19
19
  i2 = i
20
20
  i2 = 1 if i2 == 0
21
- b -= i2
21
+ b += i2
22
22
  @pc += 1 if b > e
23
23
  c = bei2x(b, e, i)
24
24
  case r.downcase
data/xlib/_xrpn_version CHANGED
@@ -1,5 +1,5 @@
1
1
  def xrpn_version
2
- puts "XRPN version: 2.7"
2
+ puts "XRPN version: 2.8"
3
3
  puts "RubyGem version: " + Gem.latest_spec_for("xrpn").version.to_s
4
4
  end
5
5
 
data/xlib/bei CHANGED
@@ -1,7 +1,12 @@
1
1
  def x2bei (x)
2
- b = x.to_i
3
- e = (1000 * (x - b)).to_i
4
- i = (((1000 * x) - (1000 * x).to_i) * 100).round()
2
+ # Decode a control number ccc.fffii. Scale by 100000 and round ONCE so
3
+ # binary-float dust does not bite: e.g. 1.003 must decode to e=3, not e=2
4
+ # ((1.003 - 1) = 0.0029999..., and (1000 * that).to_i would give 2).
5
+ b = x.to_i
6
+ total = (x.abs * 100000).round
7
+ rem = total - b.abs * 100000 # fffii as a <=5-digit integer
8
+ e = rem / 100
9
+ i = rem % 100
5
10
  i = 1 if i == 0
6
11
  return b, e, i
7
12
  end
data/xlib/raw_encoder CHANGED
@@ -80,13 +80,13 @@ def raw_encode(program, label_name = "PROG")
80
80
  if line =~ /^LBL\s+"(.+)"$/i
81
81
  lbl_name = $1
82
82
  if !main_label_written
83
- # First label is global (main entry point)
84
- result += [0xC0, 0x00, 0xF7, 0x00] # Global label header
83
+ # First label encountered → encode as global (can appear at any program step)
84
+ result += [0xC0, 0x00, 0xF7, 0x00] # Global label marker
85
85
  result += lbl_name.bytes
86
86
  # No terminator needed - next opcode (non-ASCII) terminates naturally
87
87
  main_label_written = true
88
88
  else
89
- # Subsequent labels are local
89
+ # Subsequent labels encode as local (can appear at any program step)
90
90
  result += [0xF6, 0x00]
91
91
  result += lbl_name.bytes
92
92
  # No terminator needed
data/xrpn.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'xrpn'
3
- s.version = '2.7'
3
+ s.version = '2.8'
4
4
  s.licenses = ['Unlicense']
5
5
  s.summary = "XRPN - The eXtended RPN (Reverse Polish Notation) programming language"
6
6
  s.description = "A full programming language and environment extending the features of the venerable HP calculator programmable calculators. With XRPN you can accomplish a wide range of modern programming tasks as well as running existing HP-41 FOCAL programs directly. XRPN gives modern life to tens of thousands of old HP calculator programs and opens the possibilities to many, many more. New in 2.7: Complete HP-41 RAW import/export with 100% decode success - convert HP-41 programs to XRPN and back with full support for 165+ opcodes including ALL math functions (SIN, COS, LOG, etc.), flow control, and numbers."
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xrpn
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.7'
4
+ version: '2.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-10-22 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: tty-prompt
@@ -357,7 +356,6 @@ homepage: https://github.com/isene/XRPN
357
356
  licenses:
358
357
  - Unlicense
359
358
  metadata: {}
360
- post_install_message:
361
359
  rdoc_options: []
362
360
  require_paths:
363
361
  - lib
@@ -372,8 +370,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
372
370
  - !ruby/object:Gem::Version
373
371
  version: '0'
374
372
  requirements: []
375
- rubygems_version: 3.4.20
376
- signing_key:
373
+ rubygems_version: 3.6.7
377
374
  specification_version: 4
378
375
  summary: XRPN - The eXtended RPN (Reverse Polish Notation) programming language
379
376
  test_files: []