数字是这样的:
#<BigDecimal:9829250,'0.202499E4',18(27)>
如果我打印它,它是:2024.99
。 9829250
(可能是内存地址?)和18(27)
?
答案 0 :(得分:1)
如果你安装了源码,你可以看一下。以下信息适用于本地用户安装RVM。
作为@ Dogbert的答案的替代方案,您还可以查看源文件:
cd ~/.rvm/src/ruby-2.2.4/ext/bigdecimal/
如果您在2034行左右查看bigdecimal.c
,则会看到文档:
/* Returns debugging information about the value as a string of comma-separated
* values in angle brackets with a leading #:
*
* BigDecimal.new("1234.5678").inspect ->
* "#<BigDecimal:b7ea1130,'0.12345678E4',8(12)>"
*
* The first part is the address, the second is the value as a string, and
* the final part ss(mm) is the current number of significant digits and the
* maximum number of significant digits, respectively.
*/