summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-28 01:23:55 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-07-28 01:23:55 +0000
commitae832cfa6636bd9f17fa8ed36eb602dfd646ffdb (patch)
tree69f8dd1e0b97836e3d9d0b22bba1288237a23c41
parent9121d687c5ec1322ce65543d377e4a025ba91908 (diff)
* sprintf.c (rb_f_sprintf): documentation update patch from Jacob
Fugal <lukfugl at gmail.com>. [ruby-core:08418] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--sprintf.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8bc2430348..819b39459e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 28 10:19:28 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * sprintf.c (rb_f_sprintf): documentation update patch from Jacob
+ Fugal <lukfugl at gmail.com>. [ruby-core:08418]
+
Fri Jul 28 09:41:45 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_to_s): fixed typo. [ruby-dev:29162]
diff --git a/sprintf.c b/sprintf.c
index 264b17c6b9..953ce5054c 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -216,7 +216,12 @@ sign_bits(int base, const char *p)
* s | Argument is a string to be substituted. If the format
* | sequence contains a precision, at most that many characters
* | will be copied.
- * u | Treat argument as an unsigned decimal number.
+ * u | Treat argument as an unsigned decimal number. Negative integers
+ * | are displayed as a 32 bit two's complement plus one for the
+ * | underlying architecture; that is, 2 ** 32 + n. However, since
+ * | Ruby has no inherent limit on bits used to represent the
+ * | integer, this value is preceded by two dots (..) in order to
+ * | indicate a infinite number of leading sign bits.
* X | Convert argument as a hexadecimal number using uppercase
* | letters. Negative numbers will be displayed with two
* | leading periods (representing an infinite string of
@@ -233,6 +238,7 @@ sign_bits(int base, const char *p)
* sprintf("%1$*2$s %2$d %1$s", "hello", 8) #=> " hello 8 hello"
* sprintf("%1$*2$s %2$d", "hello", -8) #=> "hello -8"
* sprintf("%+g:% g:%-g", 1.23, 1.23, 1.23) #=> "+1.23: 1.23:1.23"
+ * sprintf("%u", -123) #=> "..4294967173"
*/
VALUE