From: Holden Glova Date: 2003-08-01T20:39:12+09:00 Subject: BigDecimal from CVS -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I just got the CVS version of Ruby installed and was pleasantly surprised to see a BigDecimal class. I started playing with it in irb and came up against some confusion. 1. The comment at the top of RUBY_HOME/bigdecimal/util.rb says the following: # Float# # to_d ... to BigDecimal Yet the code says it returns a BigFloat class Float < Numeric def to_d BigFloat::new(selt.to_s) end end 2. Also, is this a typo? class Float < Numeric def to_d BigFloat::new(selt.to_s) <--- should be self? end end 3. I thought I could use String#to_d as the file comment suggests: # String# # to_d ... to BigDecimal Yet when I do this in irb it gives me an error: irb(main):002:0> require 'bigdecimal/util' => true irb(main):003:0> '111.333333'.to_d ArgumentError: wrong number of arguments(1 for 0) from /usr/lib/ruby/1.8/bigdecimal/util.rb:29:in `initialize' from /usr/lib/ruby/1.8/bigdecimal/util.rb:29:in `new' from /usr/lib/ruby/1.8/bigdecimal/util.rb:29:in `to_d' from (irb):3 User error here on my part? Thanks in advance for any responses. - -- Signed, Holden Glova -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/KlFd0X8w8X71zPcRAl69AJ98vbnn9SF6rWyzylt2Z0yAfwj2yACeNVI2 31bX/zk762+gWjrzTZ2Q6ig= =XW9P -----END PGP SIGNATURE-----