Project

General

Profile

Bug #5098

bigdecimal/util.rb で定義される to_d メソッドによる型変換と、BigDecimal 関数による型変換が整合していない

Added by mrkn (Kenta Murata) over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 1.9.4dev (2011-07-17 trunk 32564) [x86_64-darwin10.8.0]
[ruby-dev:44241]

Description

BigDecimal() および BigDecimal#coerce との関係より、以下のように修正が必要。

  • Float#to_d はオプショナルな精度を受け付けるように変更し、精度が省略された場合は Float::DIG が指定されたものとする。
  • Rational#to_d は精度を必須とする。
  • Integer#to_d を追加する。

Associated revisions

Revision 2fcb91c7
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added for symmetry to BigDecimal() function with an Integer. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 32677
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added for symmetry to BigDecimal() function with an Integer. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32677
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added for symmetry to BigDecimal() function with an Integer. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32677
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added for symmetry to BigDecimal() function with an Integer. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32677
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added for symmetry to BigDecimal() function with an Integer. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32677
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added for symmetry to BigDecimal() function with an Integer. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 079fb8d4
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for specifying precision. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 32679
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for specifying precision. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32679
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for specifying precision. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32679
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for specifying precision. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32679
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for specifying precision. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32679
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for specifying precision. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision dca0b417
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d): zero or negative precision is error. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 32680
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d): zero or negative precision is error. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32680
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d): zero or negative precision is error. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32680
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d): zero or negative precision is error. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32680
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d): zero or negative precision is error. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 32680
Added by mrkn (Kenta Murata) over 6 years ago

  • ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d): zero or negative precision is error. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Revision 2621ba04
Added by mrkn (Kenta Murata) over 6 years ago

Merge revisions 32676, 32677, 32679, 32680:
* ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d):
zero or negative precision is error. fixes #5098.

* ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for
specifying precision. fixes #5098.
* ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added
for symmetry to BigDecimal() function with an Integer.
fixes #5098.
* ext/bigdecimal/lib/bigdecimal/util.rb (BigDecimal#to_d): added
for adapting other Numeric subclasses.
* test/bigdecimal/test_bigdecimal_util.rb: add tests for the above
changes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@32687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

History

#1 Updated by mrkn (Kenta Murata) over 6 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r32677.
Kenta, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added for symmetry to BigDecimal() function with an Integer. fixes #5098.
  • test/bigdecimal/test_bigdecimal_util.rb: add test for the above change.

Also available in: Atom PDF