From 60bf66e0cd2c9f519f7dfb27eca134b86ea5dd8b Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 29 Jun 2006 09:09:33 +0000 Subject: * ext/bigdecimal/bigdecimal.c: add RDoc document. a patch from mathew . [ruby-core:07050] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/bigdecimal/lib/bigdecimal/util.rb | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'ext/bigdecimal/lib/bigdecimal/util.rb') diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb index 1f8d6c7a49..2c17aa6b8e 100644 --- a/ext/bigdecimal/lib/bigdecimal/util.rb +++ b/ext/bigdecimal/lib/bigdecimal/util.rb @@ -1,19 +1,17 @@ # # BigDecimal utility library. -# ---------------------------------------------------------------------- -# Contents: # -# String# -# to_d ... to BigDecimal +# To use these functions, require 'bigdecimal/util' +# +# The following methods are provided to convert other types to BigDecimals: # -# Float# -# to_d ... to BigDecimal +# String#to_d -> BigDecimal +# Float#to_d -> BigDecimal +# Rational#to_d -> BigDecimal # -# BigDecimal# -# to_r ... to Rational +# The following method is provided to convert BigDecimals to other types: # -# Rational# -# to_d ... to BigDecimal +# BigDecimal#to_r -> Rational # # ---------------------------------------------------------------------- # @@ -30,8 +28,8 @@ class String end class BigDecimal < Numeric - # to "nnnnnn.mmm" form digit string - # Use BigDecimal#to_s("F") instead. + # Converts a BigDecimal to a String of the form "nnnnnn.mmm". + # This method is deprecated; use BigDecimal#to_s("F") instead. def to_digits if self.nan? || self.infinite? || self.zero? self.to_s @@ -42,7 +40,7 @@ class BigDecimal < Numeric end end - # Convert BigDecimal to Rational + # Converts a BigDecimal to a Rational. def to_r sign,digits,base,power = self.split numerator = sign*digits.to_i @@ -57,7 +55,7 @@ class BigDecimal < Numeric end class Rational < Numeric - # Convert Rational to BigDecimal + # Converts a Rational to a BigDecimal def to_d(nFig=0) num = self.numerator.to_s if nFig<=0 -- cgit v1.2.3