Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4da5af7285a2
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 29b11a2707b7
Choose a head ref
  • 2 commits
  • 21 files changed
  • 2 contributors

Commits on May 20, 2015

  1. Copy the full SHA
    852a8da View commit details
  2. Merge pull request #2961 from pitr-ch/bigdecimal

    [Truffle] BigDecimal basic operations improvements, comparisons, to_s
    chrisseaton committed May 20, 2015
    Copy the full SHA
    29b11a2 View commit details
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/bigdecimal/jacobian.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/bigdecimal/jacobian'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/bigdecimal/ludcmp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/bigdecimal/ludcmp'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/bigdecimal/math.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/bigdecimal/math'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/bigdecimal/newton.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/bigdecimal/newton'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/bigdecimal/util.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require_relative '../../../stdlib/bigdecimal/util'
8 changes: 7 additions & 1 deletion lib/ruby/truffle/truffle/bigdecimal.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# TODO require bigdecimal/*
class Truffle::BigDecimal < Numeric
include Comparable

alias_method :eql?, :==
end

BigDecimal = Truffle::BigDecimal

@@ -7,3 +11,5 @@ def BigDecimal(*args)
BigDecimal.new *args
end
end

require 'bigdecimal/math'
3 changes: 2 additions & 1 deletion spec/ruby/library/bigdecimal/new_spec.rb
Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@
BigDecimal.new("1#{i}").should == 10 + i
BigDecimal.new("-1#{i}").should == -10 - i
BigDecimal.new("1E#{i}").should == 10**i
BigDecimal.new("1000000E-#{i}").should == 10**(6-i)
BigDecimal.new("1000000E-#{i}").should == 10**(6-i).to_f
# ^ to_f to avoid Rational type
}
(1..9).each {|i|
BigDecimal.new("100.#{i}").to_s.should == "0.100#{i}E3"
2 changes: 0 additions & 2 deletions spec/truffle/tags/library/bigdecimal/add_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fails:BigDecimal#add returns a + [Fixnum value] with given precision
fails:BigDecimal#add returns a + [Bignum value] with given precision
fails:BigDecimal#add favors the precision specified in the second argument over the global limit
fails:BigDecimal#add uses the current rounding mode if rounding is needed
fails:BigDecimal#add uses the default ROUND_HALF_UP rounding if it wasn't explicitly changed
3 changes: 0 additions & 3 deletions spec/truffle/tags/library/bigdecimal/comparison_tags.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
fails:BigDecimal#<=> returns 0 if a == b
fails:BigDecimal#<=> returns 1 if a > b
fails:BigDecimal#<=> returns -1 if a < b
fails:BigDecimal#<=> returns nil if NaN is involved
fails:BigDecimal#<=> returns nil if the argument is nil
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/divide_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:BigDecimal#/ returns a / b
fails:BigDecimal#/ returns 0 if divided by Infinity
fails:BigDecimal#/ returns (+|-) Infinity if (+|-) Infinity divided by one
fails:BigDecimal#/ returns NaN if Infinity / ((+|-) Infinity)
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/eql_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:BigDecimal#eql? tests for equality
fails:BigDecimal#eql? NaN is never equal to any number
fails:BigDecimal#eql? returns true for infinity values with the same sign
fails:BigDecimal#eql? returns false for infinity values with different signs
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/equal_value_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:BigDecimal#== tests for equality
fails:BigDecimal#== NaN is never equal to any number
fails:BigDecimal#== returns true for infinity values with the same sign
fails:BigDecimal#== returns false for infinity values with different signs
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/gt_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:BigDecimal#> returns true if a > b
fails:BigDecimal#> properly handles infinity values
fails:BigDecimal#> properly handles NaN values
fails:BigDecimal#> raises an ArgumentError if the argument can't be coerced into a BigDecimal
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/gte_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:BigDecimal#>= returns true if a >= b
fails:BigDecimal#>= properly handles infinity values
fails:BigDecimal#>= properly handles NaN values
fails:BigDecimal#>= returns nil if the argument is nil
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/lt_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:BigDecimal#< returns true if a < b
fails:BigDecimal#< properly handles infinity values
fails:BigDecimal#< properly handles NaN values
fails:BigDecimal#< raises an ArgumentError if the argument can't be coerced into a BigDecimal
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/lte_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:BigDecimal#<= returns true if a <= b
fails:BigDecimal#<= properly handles infinity values
fails:BigDecimal#<= properly handles NaN values
fails:BigDecimal#<= raises an ArgumentError if the argument can't be coerced into a BigDecimal
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/mult_tags.txt
Original file line number Diff line number Diff line change
@@ -3,4 +3,3 @@ fails:BigDecimal#mult returns NaN if NaN is involved
fails:BigDecimal#mult returns zero if self or argument is zero
fails:BigDecimal#mult returns infinite value if self or argument is infinite
fails:BigDecimal#mult returns NaN if the result is undefined
fails:BigDecimal#mult multiply self with other with (optional) precision
2 changes: 0 additions & 2 deletions spec/truffle/tags/library/bigdecimal/multiply_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
fails:BigDecimal#* returns zero of appropriate sign if self or argument is zero
fails:BigDecimal#* returns NaN if NaN is involved
fails:BigDecimal#* returns zero if self or argument is zero
fails:BigDecimal#* returns infinite value if self or argument is infinite
fails:BigDecimal#* returns NaN if the result is undefined
fails:BigDecimal#* multiply self with other
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/new_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:BigDecimal.new creates a new object of class BigDecimal
fails:BigDecimal.new doesn't segfault when using a very large string to build the number
fails:BigDecimal.new Number of significant digits >= given precision
fails:BigDecimal.new determines precision from initial value
1 change: 0 additions & 1 deletion spec/truffle/tags/library/bigdecimal/to_s_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
fails:BigDecimal#to_s the default format looks like 0.xxxxEnn
fails:BigDecimal#to_s takes an optional argument
fails:BigDecimal#to_s starts with + if + is supplied and value is positive
fails:BigDecimal#to_s inserts a space every n chars, if integer n is supplied
338 changes: 292 additions & 46 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/BigDecimalNodes.java

Large diffs are not rendered by default.