aboutsummaryrefslogtreecommitdiffstats
path: root/test/bigdecimal/test_bigdecimal.rb
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/bigdecimal] Fix for the coerce cases in divide and DoDivmodKenta Murata2021-01-161-0/+13
| | | | https://github.com/ruby/bigdecimal/commit/1cb92487f7
* [ruby/bigdecimal] Allow digits=0 in BigDecimal(flt) and Float#to_dKenta Murata2021-01-131-0/+2
| | | | | | | | | | | | | | Using dtoa of mode=0, we can determine the number of digits in decimal that is necessary to represent the given Float number without errors. This change permits digits=0 in BigDecimal(flt) and Float#to_d, and these methods use dtoa of mode=0 when the given digits is 0. Internal implicit conversion from Float also uses digits=0. [Fix GH-70] https://github.com/ruby/bigdecimal/commit/2dbe170e35
* [ruby/bigdecimal] Use pre-allocated objects for special valuesKenta Murata2021-01-131-1/+7
| | | | https://github.com/ruby/bigdecimal/commit/95c201f2d3
* [ruby/bigdecimal] Fix exception message raised in Kernel.BigDecimalKenta Murata2021-01-131-1/+13
| | | | | https://github.com/ruby/bigdecimal/commit/d163f170a4 https://github.com/ruby/bigdecimal/commit/ff8eeeb064
* [ruby/bigdecimal] Fix trailing zero handling in rb_uint64_convert_to_BigDecimalKenta Murata2021-01-071-0/+4
| | | | https://github.com/ruby/bigdecimal/commit/2056604d56
* [ruby/bigdecimal] Include TestBigDecimalBase in TestBigDecimalUtilKenta Murata2021-01-071-1/+1
| | | | https://github.com/ruby/bigdecimal/commit/f732201df1
* [ruby/bigdecimal] Fix test for Ruby 2.4Kenta Murata2021-01-021-10/+20
| | | | | | Ruby 2.4 does not have RbConfig::LIMITS. https://github.com/ruby/bigdecimal/commit/c8087523b0
* [ruby/bigdecimal] Implement special conversions for 64-bit integersKenta Murata2021-01-021-0/+17
| | | | | | | | | | | | | | | | | This change improves the conversion speed from small integers. ``` Comparison: big_n9 master: 4003688.9 i/s bigdecimal 3.0.0: 1270551.0 i/s - 3.15x slower big_n19 master: 5410096.4 i/s bigdecimal 3.0.0: 1000250.3 i/s - 5.41x slower ``` https://github.com/ruby/bigdecimal/commit/3429bd7e6f
* [ruby/bigdecimal] Fix test_limitKenta Murata2021-01-021-9/+10
| | | | | | | Keep the default value of BigDecimal.limit by BigDecimal.save_limit to avoid failures of the other test methods due to the unexpected limit. https://github.com/ruby/bigdecimal/commit/bdc1cc6585
* [bigdecimal] Fix deprecation warning testKenta Murata2020-12-191-0/+4
|
* [bigdecimal] Add BigDecimal#n_significant_digitsKenta Murata2020-12-191-0/+51
| | | | | https://github.com/ruby/bigdecimal/commit/981dc48f95 https://github.com/ruby/bigdecimal/commit/9ecf880ec04
* [bigdecimal] Make BigDecimal#precs deprecatedKenta Murata2020-12-191-6/+16
| | | | | https://github.com/ruby/bigdecimal/commit/7e80e6e145 https://github.com/ruby/bigdecimal/commit/0ed7846e8c
* [bigdecimal] Add BigDecimal#precisionKenta Murata2020-12-191-0/+49
| | | | https://github.com/ruby/bigdecimal/commit/458eb66c49
* [bigdecimal] Fix test for d5ab8e8562Kenta Murata2020-12-191-1/+1
|
* Import bigdecimal 2.0.2 (#3905)Kenta Murata2020-12-151-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * remove duplicated include * Make BigDecimal#round with argument < 1 return Integer Fixes [Bug #12780] * Use a higher default precision for BigDecimal#power and #** When a fractional power is given, increase the precision if the precision isn't specified via power's second argument: Float: increase by 15 (rough number of decimal precision in float) BigDecimal: increase by adding similar precision modifier as done to calculate the base precision. Rational: double the precision, since a BigDecimal is created, but the created BigDecimal uses the same precision. Increasing the precision for these power calculations has the obvious tradeoff of making the calculations slower. Fixes Ruby Bug #17264 * Use DBLE_FIG for a Float value * Version 2.0.1 Co-authored-by: pavel <pavel.rosicky@easy.cz> Co-authored-by: Jeremy Evans <code@jeremyevans.net>
* bidecimal: improve tests' independence (#3297)Kenta Murata2020-07-121-0/+4
| | | | Tests depending on the rounding mode must specify the appropriate rounding mode and restore to the original mode at the end.
* [ruby/bigdecimal] Return US-ASCII string from BigDecimal#to_sKenta Murata2020-07-061-12/+17
| | | | | | Fixes #159 https://github.com/ruby/bigdecimal/commit/57ee92e700
* [ruby/bigdecimal] Make tests pass on Ruby 2.4Jeremy Evans2020-07-061-3/+4
| | | | https://github.com/ruby/bigdecimal/commit/9d19e842ee
* [ruby/bigdecimal] Remove definition of BigDecimal#initialize_copyJeremy Evans2020-07-061-4/+6
| | | | | | This leaves the default definition, which will raise FrozenError. https://github.com/ruby/bigdecimal/commit/05e843d838
* [ruby/bigdecimal] Support a Complex in Kernel.BigDecimal()Kenta Murata2020-07-061-0/+8
| | | | https://github.com/ruby/bigdecimal/commit/00795cb01f
* [ruby/bigdecimal] Undef BigDecimal#initialize_copyJeremy Evans2020-07-061-0/+6
| | | | | | | | | Both BigDecimal#clone and BigDecimal#dup return self, there is no reason to have initialize_copy exposed as a Ruby method. The same is true for initialize_clone and initialize_dup. https://github.com/ruby/bigdecimal/commit/aaf237fa9e
* Removed duplicate test with test_BigDecimal_bug7522Nobuyoshi Nakada2020-07-051-5/+0
|
* More fixes for $SAFE/taint post mergingJeremy Evans2019-11-181-7/+9
|
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-0/+9
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* [ruby/bigdecimal] Remove taint checkingJeremy Evans2019-11-121-9/+0
| | | | | | | | This removes the taint checking. Taint support is deprecated in Ruby 2.7 and has no effect. I don't think removing the taint checks in earlier ruby versions will cause any problems. https://github.com/ruby/bigdecimal/commit/1918d466f3
* Import changes from ruby/bigdecimal (#2531)Kenta Murata2019-10-081-21/+41
| | | Sync to ruby/bigdecimal@92356ba71c6bd325b0ab618c634a7aecf8cdc767
* test/bigdecimal/test_bigdecimal.rb: Use BigDecimal()Yusuke Endoh2019-09-221-1/+1
| | | | instead of deprecated BigDecimal.new.
* Make Kernel#{Pathname,BigDecimal,Complex} return argument if given correct typeJeremy Evans2019-09-211-0/+5
| | | | | | | | | | | | This is how Kernel#{Array,String,Float,Integer,Hash,Rational} work. BigDecimal and Complex instances are always frozen, so this should not cause backwards compatibility issues for those. Pathname instances are not frozen, so potentially this could cause backwards compatibility issues by not returning a new object. Based on a patch from Joshua Ballanco, some minor changes by me. Fixes [Bug #7522]
* Suppress deprecation warningsnobu2018-12-141-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Import bigdecimal-1.4.0.pre.20181214amrkn2018-12-141-10/+22
| | | | | | * https://github.com/ruby/bigdecimal/compare/v1.4.0.pre.20181205a..v1.4.0.pre.20181214a git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Import bigdecimal 1.4.0.pre.20181205amrkn2018-12-051-83/+102
| | | | | | * https://github.com/ruby/bigdecimal/compare/74d25ef..v1.4.0.pre.20181205a git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Revert bigdecimal 1.4.0 related commitsmrkn2018-12-051-102/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Revert "Remove unnecessary linker flags" This reverts commit 49efa01579272d52d28bd361c498d96ca92e986e. * Revert "Move dependency on gemspec" This reverts commit bfb64d476578eadd61a738149726da37840f068d. * Revert "Remove unnecessary directory listing" This reverts commit 86661b5c60b8da6e5641c9c772b57857a1f988f4. * Revert "* expand tabs." This reverts commit 35ada33f8386b56611f10b1a0a4e5667e9b08071. * Revert "Import bigdecimal-1.4.0.pre-20181204a" This reverts commit 8891bb3bd602bdbabd24260cf1e431475dc027c8. * Revert "ext/bigdecimal/bigdecimal.c: drop unused function" This reverts commit 5ceeea4da1179193c2c7ddcebfd67019128473e3. * Revert "* expand tabs." This reverts commit e021386e905b6d6799a84dfbc2f0592e42626366. * Revert "Import bigdecimal-1.4.0.pre-20181130a" This reverts commit a0e438cd3c28d2eaf4efa18243d5b6edafa14d88. * Revert "NEWS: write about bigdecimal updates" This reverts commit 89455ff2ba973f2a9ee7b79657e0e6f1f31501f9. * Revert "Fix rubyspec of bigdecimal for ruby <2.6" This reverts commit 4bcdeeb65e57de4da306d347652898c767162e74. * Revert "Fix rubyspec against bigdecimal updates" This reverts commit c8fb30fc9e0ee14e87be1e231869a12aaef1eedf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Import bigdecimal-1.4.0.pre-20181204amrkn2018-12-041-0/+57
| | | | | | * https://github.com/ruby/bigdecimal/compare/v1.4.0.pre.20181130a..v1.4.0.pre.20181204a git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Import bigdecimal-1.4.0.pre-20181130amrkn2018-12-021-84/+46
| | | | | | * https://github.com/ruby/bigdecimal/compare/74d25ef..v1.4.0.pre.20181130a git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66124 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `$SAFE` as a process global state. [Feature #14250]ko12017-12-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal: version 1.3.4mrkn2017-12-241-7/+7
| | | | | | | | Import bigdecimal version 1.3.4. The full commit log is here: https://github.com/ruby/bigdecimal/compare/v1.3.3...v1.3.4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal: version 1.3.3mrkn2017-12-131-240/+283
| | | | | | | | Import bigdecimal version 1.3.3. The full commit log is here: https://github.com/ruby/bigdecimal/compare/v1.3.2...v1.3.3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Remove unnecessary `require 'thread'`kazu2017-10-081-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.h: unnormalized Fixnum valuenobu2017-09-071-0/+1
| | | | | | | * include/ruby/ruby.h (ST2FIX): fix unnormalized Fixnum value bug on mingw/mswin. [ruby-core:82687] [Bug #13877] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Removed mathn.rb from stdlib. It's deprecated from Ruby 2.2.hsbt2017-04-211-6/+0
| | | | | | [Feature #10169][[ruby-core:64553]] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal: version 1.3.0mrkn2016-12-211-1/+39
| | | | | | | | Import bigdecimal version 1.3.0. The full commit log is here: https://github.com/ruby/bigdecimal/compare/v1.3.0.pre.2...v1.3.0 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal: version 1.3.0.pre.2mrkn2016-12-101-0/+9
| | | | | | | | Import bigdecimal version 1.3.0.pre.2. The full commit log is here: https://github.com/ruby/bigdecimal/compare/v1.3.0.pre...v1.3.0.pre.2 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal: import version 1.3.0.premrkn2016-12-101-59/+217
| | | | | | | | | Import bigdecimal version 1.3.0.pre. The full commit log of this changes can be found at: https://github.com/ruby/bigdecimal/compare/5c43a9e...v1.3.0.pre git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal.c: more precisionnobu2016-10-041-0/+6
| | | | | | | * ext/bigdecimal/bigdecimal.c (BigDecimal_div2): need more room for precision to round. [ruby-core:77475] [Bug #12805] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal.c: fix FloatDomainErrornobu2016-05-231-0/+12
| | | | | | | | * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): consider non-finite float values not to raise FloatDomainError. [ruby-core:75682] [Bug #12414] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_bigdecimal.rb: adjustnobu2015-05-271-2/+2
| | | | | | | * test/bigdecimal/test_bigdecimal.rb (assert_no_memory_leak): fix GC scope and adjust limits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* bigdecimal.c: wrapper object before allocnobu2015-05-271-0/+27
| | | | | | | | | | * ext/bigdecimal/bigdecimal.c (VpNewRbClass): make wrapper object before result structs allocation and manage refcount for each elements to get rid of potential memory leak. * ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/bigdecimal/test_bigdecimal.rb: Add test for mult by nil.headius2014-11-131-0/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e