Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: itaylor@uark.edu (Ian Taylor)
Subject: [sup-talk] Util - Fixnum num_digits is wrong
Date: Mon, 03 Dec 2007 03:25:15 -0500	[thread overview]
Message-ID: <1196670157-sup-6857@silver> (raw)

Probably wasn't causing any problems, but is wrong.

===================================================================
--- lib/sup/util.rb     (revision 737)
+++ lib/sup/util.rb     (working copy)
@@ -299,7 +299,7 @@
 class Fixnum
   def num_digits base=10
     return 1 if self == 0
-    1 + (Math.log(self) / Math.log(10)).floor
+    1 + (Math.log(self) / Math.log(base)).floor
   end
   
   def to_character

-- 
Ian Taylor


             reply	other threads:[~2007-12-03  8:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03  8:25 Ian Taylor [this message]
2007-12-03 10:52 ` Shot (Piotr Szotkowski)
2007-12-08 22:13   ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1196670157-sup-6857@silver \
    --to=itaylor@uark.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox