ae_fast_decimal_formatter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8d0765a81889d9e8cb54d9961fd5bc6e7daf282e767bc10f33fb5c6660df418
4
- data.tar.gz: 8f0064baa8132ac69a131d3c45a3917d1288672815a7bd280ff5c718e9e62b05
3
+ metadata.gz: 59156225262394ee5540585652a72a196b60845ef06bb64d8409c590f62e535d
4
+ data.tar.gz: 1dc099b29def36a2f513c6a70d3772ce5df6c48c7a0465ca64e39a300a9dbaa7
5
5
  SHA512:
6
- metadata.gz: ce7e446c20366f9b69bdf58285d6b960957ecbd96f88ca427d6d3e9e9c80cb5b0fa325b21f726544bb33b888c49aef309d16db76d1bee44a4ab357efbb757a0e
7
- data.tar.gz: 55fe31c15e4a985a36cb6580685a82043407761c4c086f2da809ad6ff421a0cee776555ba712ac0190577e2abd8e8d2a08dcd017e87687095c1ddeb0651c6fb4
6
+ metadata.gz: 9d10f701251c18ca9bba7261635a8723370825a4abc5feee17520a7d9fb64d347bd5bf17fcbdd1e0ccd797bc6536895d9e3e7c7df780e41ddca6646d626b7fa4
7
+ data.tar.gz: 70abf3b82f2e17cf81010fd8538095c041f717e9d3fc4035dffada029c043ca5e106ea716c696a5469df1fbd87cc42a1e27ab771cbaba23c7a7e1a5b958281ff
@@ -18,8 +18,13 @@ VALUE c_format_decimal(double num, int precision)
18
18
  formatstr[9] = 0;
19
19
 
20
20
  if (precision > 0) {
21
- rounding_factor = pow(10.0, precision);
22
- rounded_num = round(num * rounding_factor) / rounding_factor;
21
+ rounding_factor = (double) 10.0;
22
+ for (i = 1; i < precision; i++) { rounding_factor *= (double) 10.0; }
23
+
24
+ double multiplied_num = num * (double) 10.0;
25
+ for (i = 1; i < precision; i++) { multiplied_num *= (double) 10.0; }
26
+
27
+ rounded_num = round(multiplied_num) / rounding_factor;
23
28
  } else {
24
29
  rounded_num = round(num);
25
30
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ae_fast_decimal_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appfolio Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-14 00:00:00.000000000 Z
11
+ date: 2021-05-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Efficiently format decimal number so that reports of millions of decimal
14
14
  cells are fast
@@ -26,7 +26,7 @@ licenses:
26
26
  - MIT
27
27
  metadata:
28
28
  allowed_push_host: https://rubygems.org
29
- post_install_message:
29
+ post_install_message:
30
30
  rdoc_options: []
31
31
  require_paths:
32
32
  - lib
@@ -34,18 +34,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
34
34
  requirements:
35
35
  - - ">="
36
36
  - !ruby/object:Gem::Version
37
- version: 2.3.3
37
+ version: 2.6.3
38
38
  - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: '2.7'
40
+ version: '3'
41
41
  required_rubygems_version: !ruby/object:Gem::Requirement
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  requirements: []
47
- rubygems_version: 3.0.3
48
- signing_key:
47
+ rubygems_version: 3.0.8
48
+ signing_key:
49
49
  specification_version: 4
50
50
  summary: Efficiently format decimal number
51
51
  test_files: []