diff options
author | BurdetteLamar <BurdetteLamar@Yahoo.com> | 2021-11-12 08:46:30 -0600 |
---|---|---|
committer | Kenta Murata <mrkn@mrkn.jp> | 2021-12-24 02:28:53 +0900 |
commit | 973e50847248816dea856b48a197320a60f3de2b (patch) | |
tree | bd3a9cb544373c00de99f64f73eddc4bc16ba690 /ext/bigdecimal/bigdecimal.c | |
parent | 5888d3030d822f8554bb2788fc2e8dd24d3afc65 (diff) |
[ruby/bigdecimal] Respond to review for #precision
https://github.com/ruby/bigdecimal/commit/681cd2d81d
Diffstat (limited to 'ext/bigdecimal/bigdecimal.c')
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index cee74a5880..68cb31d24b 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -325,20 +325,13 @@ BigDecimal_prec(VALUE self) * * Returns the number of decimal digits in +self+: * - * %w[0 1 -1e20 1e-20 Infinity -Infinity NaN].each do |s| - * precision = BigDecimal(s).precision - * puts format("%9s has precision %2d", s, precision) - * end - * - * Output: - * - * 0 has precision 0 - * 1 has precision 1 - * -1e20 has precision 21 - * 1e-20 has precision 20 - * Infinity has precision 0 - * -Infinity has precision 0 - * NaN has precision 0 + * BigDecimal("0").precision # => 0 + * BigDecimal("1").precision # => 1 + * BigDecimal("-1e20").precision # => 21 + * BigDecimal("1e-20").precision # => 20 + * BigDecimal("Infinity").precision # => 0 + * BigDecimal("-Infinity").precision # => 0 + * BigDecimal("NaN").precision # => 0 * */ static VALUE |