ruby-changes:73725
From: Maciek <ko1@a...>
Date: Sun, 25 Sep 2022 16:51:31 +0900 (JST)
Subject: [ruby-changes:73725] 8e2c425183 (master): [ruby/bigdecimal] Improve documentation of BigDecimal#sign
https://git.ruby-lang.org/ruby.git/commit/?id=8e2c425183 From 8e2c42518355f3e29f5693de9034fb66a2abbdaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciek=20Rz=C4=85sa?= <maciejrzasa@g...> Date: Thu, 28 Jul 2022 14:30:10 +0200 Subject: [ruby/bigdecimal] Improve documentation of BigDecimal#sign Fixes https://github.com/ruby/bigdecimal/issues/78 by describing behaviour for positive and negative zero in the docs. https://github.com/ruby/bigdecimal/commit/5415b120ab --- ext/bigdecimal/bigdecimal.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index b3ef70a2c9..06c8251cc2 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -3606,8 +3606,10 @@ BigDecimal_limit(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L3606 /* Returns the sign of the value. * - * Returns a positive value if > 0, a negative value if < 0, and a - * zero if == 0. + * Returns a positive value if > 0, a negative value if < 0. + * It behaves the same with zeros - + * it returns a positive value for a positive zero (BigDecimal('0')) and + * a negative value for a negative zero (BigDecimal('-0')). * * The specific value returned indicates the type and sign of the BigDecimal, * as follows: -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/