[PLUG] OT: Formula For Determining # Of Digits In An Integer
Shahms King
shahms at shahms.com
Thu Feb 17 22:48:39 UTC 2005
On Thu, 2005-02-17 at 14:31 -0800, Jason Van Cleve wrote:
> Quoth Galen Seitz, on Thu, 17 Feb 2005 14:05:41 -0800:
>
> > Brute force?
> >
> > y = floor(log10((double)x)) + 1;
>
> The "log10" is probably what I'm looking for. I should have noted I'm
> doing this in Java; and Java has a one-argument 'log()' method, but it's
> base "e", and it looks like I need a base-ten logorithm?
Yeah, in my mail (buried in with the rest of the stuff) is the simple
formula for computing a log in an arbitrary base:
log(n, base) -> log(n)/log(base)
--
Shahms E. King <shahms at shahms.com>
Multnomah ESD
Public Key:
http://shahms.mesd.k12.or.us/~sking/shahms.asc
Fingerprint:
1612 054B CE92 8770 F1EA AB1B FEAB 3636 45B2 D75B
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.pdxlinux.org/pipermail/plug/attachments/20050217/9222034f/attachment.asc>
More information about the PLUG
mailing list