Skip to content

Commit

Permalink
Update bigdecimal files from 3.1
Browse files Browse the repository at this point in the history
These will eventually be sourced from the gem.

ruby/bigdecimal#169
  • Loading branch information
headius committed Jan 27, 2022
1 parent 76d58ae commit 0a4b581
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/ruby/stdlib/bigdecimal/ludcmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ def lusolve(a,b,ps,zero=0.0)
end
x <<= b[ps[i]] - dot
end
(n-1).downto(0) do |i2|
(n-1).downto(0) do |i|
dot = zero
psin = ps[i2]*n
for j in (i2+1)...n do
psin = ps[i]*n
for j in (i+1)...n do
dot = a[psin+j].mult(x[j],prec) + dot
end
x[i2] = (x[i2]-dot).div(a[psin+i2],prec)
x[i] = (x[i]-dot).div(a[psin+i],prec)
end
x
end
Expand Down
1 change: 0 additions & 1 deletion lib/ruby/stdlib/bigdecimal/math.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: false
require 'bigdecimal'
require 'bigdecimal/util'

#
#--
Expand Down
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/bigdecimal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Float < Numeric
#
# See also BigDecimal::new.
#
def to_d(precision=Float::DIG+1)
def to_d(precision=0)
BigDecimal(self, precision)
end
end
Expand Down

0 comments on commit 0a4b581

Please sign in to comment.