Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigdecimal & bigmath #3271

Merged
merged 11 commits into from
Aug 21, 2015
Merged

bigdecimal & bigmath #3271

merged 11 commits into from
Aug 21, 2015

Conversation

ahorek
Copy link
Contributor

@ahorek ahorek commented Aug 20, 2015

Implemets:
bigdecimal#.to_r
bigmath#.exp

Fixes:
CMP/COERCE bigdecimals -> floats / rationals
Exceptions
Missing require
Tests, clean up

References:
#1186

@kares
Copy link
Member

kares commented Aug 21, 2015

you seem to have added a lot of new excludes ... those were passing before, right?
UPDATE: looking the wrong direction at the changes - you fixed a lot of excludes ... very najs work!
... still your commit messages could use some chit-chat :)

would be great to handle the new failures before merging: https://travis-ci.org/jruby/jruby/jobs/76473460#L9846-L9885

also this would be useful to backport to 1.7.x ... were you matching MRI 1.9.3 or 2.2 compatibility?

@ahorek
Copy link
Contributor Author

ahorek commented Aug 21, 2015

there are some minor cases when we don't match MRI:
1/ sometimes precision isn't limited
2/ special modes like BigDecimal::ROUND_MODE & BigDecimal::EXCEPTIONS are sometimes ignored / not implemented
3/ BigDecimal.pow works but it's extremely slow (see test_exception_overflow)
4/ MRI's BigDecimal can handle larger exponents, Java's BigInteger class can not
BigDecimal("10E1999999999") MRI => 0.1E2000000000, JRuby => Infinity
5/ #3242

nice to have:
BigMath.log / exp should be implemented natively like MRI did since Ruby 2.0.

all my changes are complatible with MRI 1.9.3, so backporting shouln't be a problem. I've also added comments and fixed broken tests.

enebo added a commit that referenced this pull request Aug 21, 2015
@enebo enebo merged commit 3584f55 into jruby:master Aug 21, 2015
@enebo enebo added this to the JRuby 9.0.1.0 milestone Aug 21, 2015
@enebo
Copy link
Member

enebo commented Aug 21, 2015

@ahorek can we trouble you for a second PR for jruby-1_7 branch? I suspect we cannot cherry-pick this.

ahorek added a commit to ahorek/jruby that referenced this pull request Aug 23, 2015
ahorek added a commit to ahorek/jruby that referenced this pull request Aug 23, 2015
ahorek added a commit to ahorek/jruby that referenced this pull request Aug 23, 2015
ahorek added a commit to ahorek/jruby that referenced this pull request Aug 23, 2015
ahorek added a commit to ahorek/jruby that referenced this pull request Aug 24, 2015
enebo added a commit that referenced this pull request Aug 24, 2015
kares added a commit that referenced this pull request Aug 25, 2015
* jruby-1_7: (27 commits)
  meh,  use the included hook instead to get a simple test skip on --1.8 mode
  some more --1.8 skip fixes (4 less future surprises)
  test skip 1.8.7 test-unit compatibility
  adding a skip-ed test-case for callin abstract (Ruby impl) method in constructor
  less intermediate strings on proxy class name generation
  some notes on Java proxy invocation handler class hierarchy + un-used import
  make generated Java proxy class fields final
  include_package spec no longer pending
  [ji] include package should work with a package instance (just like import)
  java_alias should not fail when no include_package called previously
  add a possible TODO note for proc-to-iface dispatch
  Fix VERSION so jruby-jars builds find the right jars.
  Update joda time to 2.8.2.
  Fixes #3286. Encoding of symbol literals does not respect the encoding of the source file (1.9 edition)
  Move psych to 1.9 lib so only 1.9 and 2.0 modes can see it.
  backport #3271, #3211, #3221
  [ji] improved more-specific type matching when matching Java methods
  another (pending) Java 8 JI spec - hitting the wall with Predicate#test(arg1)
  Exclude odd DateTime roundtrip failure in Psych.
  Update psych+tests to 2.0.15.
  ...

Conflicts:
	.travis.yml
	VERSION
	core/pom.xml
	core/src/main/java/org/jruby/ext/bigdecimal/RubyBigDecimal.java
	core/src/main/java/org/jruby/ext/psych/PsychLibrary.java
	core/src/main/java/org/jruby/ext/psych/PsychParser.java
	core/src/main/java/org/jruby/ext/psych/PsychToRuby.java
	core/src/main/java/org/jruby/parser/ParserSupport.java
	core/src/main/java/org/jruby/parser/Ruby19Parser.java
	core/src/main/java/org/jruby/parser/Ruby19Parser.y
	docs/man/pom.xml
	docs/pom.xml
	ext/pom.xml
	ext/readline/pom.xml
	ext/ripper/pom.xml
	lib/pom.rb
	lib/pom.xml
	lib/ruby/1.8/bigdecimal/math.rb
	lib/ruby/1.9/bigdecimal/math.rb
	lib/ruby/1.9/psych.rb
	lib/ruby/1.9/psych/coder.rb
	lib/ruby/1.9/psych/core_ext.rb
	lib/ruby/1.9/psych/deprecated.rb
	lib/ruby/1.9/psych/handler.rb
	lib/ruby/1.9/psych/handlers/document_stream.rb
	lib/ruby/1.9/psych/handlers/recorder.rb
	lib/ruby/1.9/psych/json/ruby_events.rb
	lib/ruby/1.9/psych/json/stream.rb
	lib/ruby/1.9/psych/json/tree_builder.rb
	lib/ruby/1.9/psych/json/yaml_events.rb
	lib/ruby/1.9/psych/nodes.rb
	lib/ruby/1.9/psych/nodes/alias.rb
	lib/ruby/1.9/psych/nodes/document.rb
	lib/ruby/1.9/psych/nodes/mapping.rb
	lib/ruby/1.9/psych/nodes/node.rb
	lib/ruby/1.9/psych/nodes/scalar.rb
	lib/ruby/1.9/psych/nodes/sequence.rb
	lib/ruby/1.9/psych/nodes/stream.rb
	lib/ruby/1.9/psych/omap.rb
	lib/ruby/1.9/psych/parser.rb
	lib/ruby/1.9/psych/scalar_scanner.rb
	lib/ruby/1.9/psych/set.rb
	lib/ruby/1.9/psych/stream.rb
	lib/ruby/1.9/psych/syntax_error.rb
	lib/ruby/1.9/psych/tree_builder.rb
	lib/ruby/1.9/psych/visitors.rb
	lib/ruby/1.9/psych/visitors/depth_first.rb
	lib/ruby/1.9/psych/visitors/emitter.rb
	lib/ruby/1.9/psych/visitors/json_tree.rb
	lib/ruby/1.9/psych/visitors/to_ruby.rb
	lib/ruby/1.9/psych/visitors/visitor.rb
	lib/ruby/1.9/psych/visitors/yaml_tree.rb
	lib/ruby/1.9/psych/y.rb
	lib/ruby/2.0/bigdecimal/math.rb
	maven/jruby-complete/pom.xml
	maven/jruby-dist/pom.xml
	maven/jruby-jars/pom.xml
	maven/jruby-noasm/pom.xml
	maven/jruby-rake-plugin/pom.xml
	maven/jruby-stdlib/pom.xml
	maven/jruby/pom.xml
	maven/pom.xml
	pom.xml
	spec/java_integration/packages/access_spec.rb
	test/externals/ruby1.9/psych/helper.rb
	test/externals/ruby1.9/psych/test_alias_and_anchor.rb
	test/externals/ruby1.9/psych/test_array.rb
	test/externals/ruby1.9/psych/test_boolean.rb
	test/externals/ruby1.9/psych/test_class.rb
	test/externals/ruby1.9/psych/test_coder.rb
	test/externals/ruby1.9/psych/test_date_time.rb
	test/externals/ruby1.9/psych/test_deprecated.rb
	test/externals/ruby1.9/psych/test_document.rb
	test/externals/ruby1.9/psych/test_emitter.rb
	test/externals/ruby1.9/psych/test_encoding.rb
	test/externals/ruby1.9/psych/test_exception.rb
	test/externals/ruby1.9/psych/test_hash.rb
	test/externals/ruby1.9/psych/test_json_tree.rb
	test/externals/ruby1.9/psych/test_merge_keys.rb
	test/externals/ruby1.9/psych/test_nil.rb
	test/externals/ruby1.9/psych/test_null.rb
	test/externals/ruby1.9/psych/test_numeric.rb
	test/externals/ruby1.9/psych/test_object.rb
	test/externals/ruby1.9/psych/test_object_references.rb
	test/externals/ruby1.9/psych/test_omap.rb
	test/externals/ruby1.9/psych/test_parser.rb
	test/externals/ruby1.9/psych/test_psych.rb
	test/externals/ruby1.9/psych/test_scalar.rb
	test/externals/ruby1.9/psych/test_scalar_scanner.rb
	test/externals/ruby1.9/psych/test_serialize_subclasses.rb
	test/externals/ruby1.9/psych/test_set.rb
	test/externals/ruby1.9/psych/test_stream.rb
	test/externals/ruby1.9/psych/test_string.rb
	test/externals/ruby1.9/psych/test_struct.rb
	test/externals/ruby1.9/psych/test_symbol.rb
	test/externals/ruby1.9/psych/test_tainted.rb
	test/externals/ruby1.9/psych/test_to_yaml_properties.rb
	test/externals/ruby1.9/psych/test_tree_builder.rb
	test/externals/ruby1.9/psych/test_yaml.rb
	test/externals/ruby1.9/psych/test_yamldbm.rb
	test/externals/ruby1.9/psych/test_yamlstore.rb
	test/externals/ruby1.9/psych/visitors/test_to_ruby.rb
	test/externals/ruby1.9/psych/visitors/test_yaml_tree.rb
	test/pom.xml
	test/test_command_line_switches.rb
	test/test_helper.rb
	test/test_higher_javasupport.rb
	test/test_load_gem_extensions.rb
	test/test_zlib.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants