checkpercentage 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/checkpercentage.rb +2 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2698e0c3ab8c861ab8debd0c4576cef64f194767
4
- data.tar.gz: fc8e54c4d836160bf565602f5a281b65346a841c
3
+ metadata.gz: 21383b5431b4212ff2f889a232962131ba469ca2
4
+ data.tar.gz: dc515dbc1ccb8c267bbaa5cb943ca167fd55a43e
5
5
  SHA512:
6
- metadata.gz: c4e76c2820750a23ce6ae7196010bfabcce561aabcf2687110509df29686e8f77f4179595c2426a6044e7dda20ad49b5256281f52500754a147f23aa41e92ee0
7
- data.tar.gz: 9a39436fb4afb784e3c44022f2c364f9d7279bf71a636b1f765e341f1dd33e559b47ae873655e9b950ceba7ab27aa30e2cb1d8a9c0f5b86e10acba57f0d07ad2
6
+ metadata.gz: 134fd4cd344294ff4a3317713a4f01f3497616544bdbfe7098042f962328effa64d14c26bb55301c4ee0208dd50eda51d9f1073545bdac52ce3d33182047d7c8
7
+ data.tar.gz: 1a98477a38072dbffabc91a37f9d410bfd5b45da14b8d9e0156081fffc734aa61ee5d64d320e035c1ec5ed152b74b8587feb86633b86e7a3873bf65692a00297
@@ -8,13 +8,13 @@ class Checkpercentage
8
8
 
9
9
  #2) x is what percentage of y?
10
10
  def self.find_percent(amount, base)
11
- result_percent = amount/base * 100
11
+ result_percent = (amount.to_f.round(2)/base.to_f.round(2) * 100).ceil
12
12
  return result_percent
13
13
  end
14
14
 
15
15
  #3) x is y% of what number?
16
16
  def self.find_base(amount, rate)
17
- result_base = amount/rate * 100
17
+ result_base = (amount.to_f.round(2)/rate.to_f.round(2) * 100).ceil
18
18
  return result_base
19
19
  end
20
20
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: checkpercentage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Zacchi