t-rex 2.0.1 → 2.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/t-rex +15 -1
  3. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ee5b8327cde649f9a956b13f7b45417a001cdfb58821fea54eead6f8d301e8c
4
- data.tar.gz: f48df29eca7df03d52a5a4ccf19ef082b7d033f3b6bf12faed1f4a0453fa4bec
3
+ metadata.gz: cc55f9485a29e3fbe0c29a51086e83ac0381fc221a1edb186a6282f3a56a03d4
4
+ data.tar.gz: d3e0ed8a6f61edcbfaa9228c765c545c209cbaa1714151cd5bb8ff6d6dddc262
5
5
  SHA512:
6
- metadata.gz: 38f48b4d4b71872813572877e4491b076611a5105552f3e6764113a7206dbe21eaf215a9adfdaf8c459ee8b652f74ca7cebb96f7cc17eb055528be8c3da80417
7
- data.tar.gz: 826df5c564da15c7917a1d718c9bb9df7c96c880ef4b29dcf768cebde1ca6ceb766f4513ed5d6854102578c1f50053d6ec9dc4edc9d8f340984aa800d1725299
6
+ metadata.gz: bae00939e5215a19d75cfcfa152129785f20e47558c717236c35ca39d67e342d78033618836c2d608d351d9db2fc09f4fe9813cca7fea1a93ac954b3818178ec
7
+ data.tar.gz: 85005f785b9889b259e56d5061791c2219bc3e4c95bf9ecce60e7ed2ae69bbbdfc4723e1673e1f5284e8670d4315aa6984bb04a8819b532bce916d5aa0e2e013
data/bin/t-rex CHANGED
@@ -28,6 +28,10 @@ help = <<HELPTEXT
28
28
  operating stack. L is the "Last X" register showing the previous value in X.
29
29
  Toggle US and European number formats by pressing '.
30
30
 
31
+ When entering a number into X, use 'h' to change the sign and 'e' to write an
32
+ exponent (10^x). Entering "123e4" becomes "1230000". Use 'H' to enter a minus sign
33
+ after an 'e' to get a negative exponent. Entering "123e-4" becomes "0.0123".
34
+
31
35
  Functions available are shown under the stack registers. The orange symbol
32
36
  corresponds to the key to be pressed. For functions above each label (grey
33
37
  functions), press the Control key (Ctrl) and the orange key (asin = Ctrl+i).
@@ -632,7 +636,7 @@ def entry(chr) # X REGISTER ENTRY
632
636
  pos = 1
633
637
  Rcurses::Cursor.set(7,33)
634
638
  Rcurses::Cursor.show
635
- while %w[0 1 2 3 4 5 6 7 8 9 . , h RIGHT LEFT HOME END DEL BACK WBACK LDEL].include?(chr)
639
+ while %w[0 1 2 3 4 5 6 7 8 9 . , h H e RIGHT LEFT HOME END DEL BACK WBACK LDEL].include?(chr)
636
640
  @p_x.puts(num)
637
641
  chr = getchr
638
642
  case chr
@@ -676,6 +680,12 @@ def entry(chr) # X REGISTER ENTRY
676
680
  num.insert(0, "-")
677
681
  pos += 1
678
682
  end
683
+ when 'H'
684
+ num.insert(pos,"-")
685
+ pos += 1
686
+ when 'e'
687
+ num.insert(pos,chr)
688
+ pos += 1
679
689
  when /[0-9.,]/
680
690
  num.insert(pos,chr)
681
691
  pos += 1
@@ -684,6 +694,10 @@ def entry(chr) # X REGISTER ENTRY
684
694
  end
685
695
  num = "" if %w[DOWN UP].include?(chr)
686
696
  num.gsub!(/,/, '.')
697
+ if num.include?("e")
698
+ base, exp_str = num.split("e")
699
+ num = (base.to_f * (10 ** exp_str.to_i)).to_s
700
+ end
687
701
  num != "" ? number = num.to_f : number = ""
688
702
  Rcurses::Cursor.hide
689
703
  return number, chr
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t-rex
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: '2.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geir Isene
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-12 00:00:00.000000000 Z
11
+ date: 2025-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rcurses
@@ -26,8 +26,9 @@ dependencies:
26
26
  version: '2.4'
27
27
  description: 'This is a terminal curses RPN calculator similar to the traditional
28
28
  calculators from Hewlett Packard. See https://www.hpmuseum.org/rpn.htm for info
29
- on RPN (Reverse Polish Notation). New in 2.0: Full rewrite with rcurses, face lift,
30
- new functionality, bug fixes. 2.0.1: Gemspec, Readme fixes.'
29
+ on RPN (Reverse Polish Notation). New in 2.1: Added ''e'' for entering exponents
30
+ directly into X. 2.2: Allowing for negative exponents (use ''H'' to enter a minus
31
+ sign).'
31
32
  email: g@isene.com
32
33
  executables:
33
34
  - t-rex