. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Server IP : 104.21.41.133 / Your IP :
3.15.238.90 [
Web Server : LiteSpeed System : Linux altar63.supremepanel63.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : abranoticias ( 1103) PHP Version : 8.0.30 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/alt/ruby18/lib64/ruby/1.8/bigdecimal/ |
Upload File : |
# # BigDecimal utility library. # # To use these functions, require 'bigdecimal/util' # # The following methods are provided to convert other types to BigDecimals: # # String#to_d -> BigDecimal # Float#to_d -> BigDecimal # Rational#to_d -> BigDecimal # # The following method is provided to convert BigDecimals to other types: # # BigDecimal#to_r -> Rational # # ---------------------------------------------------------------------- # class Float < Numeric def to_d BigDecimal(self.to_s) end end class String def to_d BigDecimal(self) end end class BigDecimal < Numeric # 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 else i = self.to_i.to_s s,f,y,z = self.frac.split i + "." + ("0"*(-z)) + f end end # Converts a BigDecimal to a Rational. def to_r sign,digits,base,power = self.split numerator = sign*digits.to_i denomi_power = power - digits.size # base is always 10 if denomi_power < 0 Rational(numerator,base ** (-denomi_power)) else Rational(numerator * (base ** denomi_power),1) end end end class Rational < Numeric # Converts a Rational to a BigDecimal def to_d(nFig=0) num = self.numerator.to_s if nFig<=0 nFig = BigDecimal.double_fig*2+1 end BigDecimal.new(num).div(self.denominator,nFig) end end