monies 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/monies.rb +3 -1
- data/monies.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ffee4b91733b331056188aef0f3576b9e90fc16847f91174749f7ffc154e7ff
|
4
|
+
data.tar.gz: bac13063005ebde101cf5faa4405fcfe48c1107bb10e6568ae35fe9c51191ce7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7a50b0b8c9584a16dc75be18bac0e54f706028cda755d501e8e91f3a2c84487b4b4763ac6ba651c36ccb70b2b275baa445983133982d926efb299653989611b
|
7
|
+
data.tar.gz: 9a1f89469a73048e45e55cd6db7e3a93b4e2cfc99a9a5dbf6d247e56ee89f68ddea4bd76b66d819e8e844f5967911878a88c7a12996743923416e475d56db57d
|
data/lib/monies.rb
CHANGED
@@ -389,7 +389,7 @@ class Monies
|
|
389
389
|
def divide(value, scale, divisor, max_scale)
|
390
390
|
quotient, carry = 0, 0
|
391
391
|
|
392
|
-
value.digits.reverse_each do |digit|
|
392
|
+
value.abs.digits.reverse_each do |digit|
|
393
393
|
dividend = carry + digit
|
394
394
|
|
395
395
|
quotient = (quotient * BASE) + (dividend / divisor)
|
@@ -411,6 +411,8 @@ class Monies
|
|
411
411
|
iterations -= 1
|
412
412
|
end
|
413
413
|
|
414
|
+
quotient = -quotient if value.negative?
|
415
|
+
|
414
416
|
self.class.new(quotient, scale, @currency)
|
415
417
|
end
|
416
418
|
|
data/monies.gemspec
CHANGED