plurimath 0.9.3 → 0.9.5

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: 65b30f602bdfb128eb92f4cc3c1677585f8ec721cc3faa187b32f353486b0a10
4
- data.tar.gz: b9babf5d6792d1f8fc6254ed59f18e48e9e8595051810c7fc2a5fbbbfa228ba2
3
+ metadata.gz: 7394b4bc80e849dee8177592843aa9c9d45787e990262fc5697d98cff5dce430
4
+ data.tar.gz: 8ffee0aa744fa4e78be377477b7a4469ff83955da1496c8c1e6b758f2301e03a
5
5
  SHA512:
6
- metadata.gz: 7f8ea11095e08057dfa814d69b88348a62887d201a212c4761269e4455287ff6142e75015a7b5df83d73228af15b8e8caaf44d9e0371b6c241876994883ced15
7
- data.tar.gz: a83989cab70e5d880f06e46a027aaecb463286f74800a7e5f89a5ad8536afcc415a17c74687393df514fd50a1474d9d02e774e35e608d90762471a8122cf4c05
6
+ metadata.gz: 7b63df23644a7b5a726a20d860f2f372a0afd0e00cfcc75f0a189b125895c3eeaa2fed6100ae284a185a6691e80a787dd8a5653554f2f71f6b60c33e46f70786
7
+ data.tar.gz: cd2c261d539cb96cbe8f7aa7d01167b0e88a6de619859e6fa6ce71facb61a685ca58ea91bb71920514aa895a92f1083cd6cfc29646cb49a15b18362dc4790f80
@@ -18,8 +18,12 @@ module Plurimath
18
18
  precision = options[:precision] || @precision
19
19
  return "" unless precision > 0
20
20
 
21
- number = format(fraction, precision)
22
- number = digit_count_format(int, fraction, number) if @digit_count
21
+ number = if @digit_count
22
+ digit_count_format(int, fraction)
23
+ else
24
+ format(fraction, precision)
25
+ end
26
+
23
27
  formatted_number = change_format(number) if number
24
28
  formatted_number ? decimal + formatted_number : ""
25
29
  end
@@ -40,18 +44,17 @@ module Plurimath
40
44
  tokens.compact.join(separator)
41
45
  end
42
46
 
43
- def digit_count_format(int, fraction, number)
47
+ def digit_count_format(int, fraction)
44
48
  integer = int + "." + fraction
45
- float = BigDecimal(integer)
46
- int_length = integer.length - 1
49
+ int_length = integer.length - 1 # integer length; excluding the decimal point
47
50
  @digit_count ||= int_length
48
51
  if int_length > @digit_count
49
- number_string = float.round(@digit_count - int.length)
52
+ number_string = BigDecimal(integer).round(@digit_count - int.length)
50
53
  numeric_digits(number_string) if @digit_count > int.length
51
54
  elsif int_length < @digit_count
52
- number + "0" * (update_digit_count(number) - int_length)
55
+ fraction + ("0" * (update_digit_count(fraction) - int_length))
53
56
  else
54
- number
57
+ fraction
55
58
  end
56
59
  end
57
60
 
@@ -183,6 +183,14 @@ module Plurimath
183
183
  )
184
184
  end
185
185
 
186
+ rule(power: simple(:power),
187
+ symbols: simple(:sym)) do
188
+ Math::Function::Power.new(
189
+ power,
190
+ Utility.symbols_class(sym, lang: :latex),
191
+ )
192
+ end
193
+
186
194
  rule(power: simple(:power),
187
195
  expression: simple(:expr)) do
188
196
  Math::Function::Power.new(
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Plurimath
4
- VERSION = "0.9.3"
4
+ VERSION = "0.9.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plurimath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-04-13 00:00:00.000000000 Z
11
+ date: 2025-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ox