![]() | Binary logarithm has been listed as one of the
Mathematics good articles under the
good article criteria. If you can improve it further,
please do so. If it no longer meets these criteria, you can
reassess it. Review: December 29, 2015. ( Reviewed version). |
![]() | A fact from Binary logarithm appeared on Wikipedia's
Main Page in the
Did you know column on 6 January 2016 (
check views). The text of the entry was as follows:
| ![]() |
![]() | This ![]() It is of interest to the following WikiProjects: | ||||||||||
|
Where did the algorithm given here come from? I would love to find an original reference for this. Kleg 22:45, 19 July 2006 (UTC)
Same here. I can sort of guess why it works (squaring the scaled input value corresponds to doubling the result), but I would love to see the actual maths behind it.
Math for the result is located at this url: http://en.literateprograms.org/Logarithm_Function_%28Python%29
not a function! A function has a domain, a range, and a graph!
Where does the name lg come from? -- Abdull ( talk) 20:15, 24 July 2008 (UTC)
Isn't there an error in the identity given for integers?
It says:
But surely it should be:
? —Preceding unsigned comment added by 195.27.20.35 ( talk) 12:05, 26 February 2010 (UTC)
Python example is clearly too complex and too long. 1exec1 ( talk) 17:53, 24 April 2010 (UTC)
Then refer to the OLD python code, it is much simpler
#!/usr/bin/python from __future__ import division def log2(X): epsilon = 1.0/(10**12) integer_value=0 while X < 1: integer_value = integer_value - 1 X = X * 2 while X >= 2: integer_value = integer_value + 1 X = X / 2 decfrac = 0.0 partial = 0.5 X=X*X while partial > epsilon: if X >= 2: decfrac = decfrac + partial X = X / 2 partial = partial / 2 X=X*X return (integer_value + decfrac) if __name__ == '__main__': value = 4.5 print " X =",value print "LOG2(X) =",log2(value) # Sample output # # $ python log2.py # X = 4.5 # LOG2(X) = 2.16992500144 #
wouldn't it be nicer code to use
while(n>>=1!=0) ++pos;
instead of
if (n >= 1<<16) { n >>= 16; pos += 16; } if (n >= 1<< 8) { n >>= 8; pos += 8; } if (n >= 1<< 4) { n >>= 4; pos += 4; } if (n >= 1<< 2) { n >>= 2; pos += 2; } if (n >= 1<< 1) { pos += 1; }
? -- 129.247.247.239 ( talk) 11:53, 16 July 2010 (UTC)
Under "Information Theory" the notation lb rather than ld is suddenly used without explanation. Is this a typo? If not, perhaps it should say something like: lg, lx, and lb are sometimes used for base 2 logs.
GA toolbox |
---|
Reviewing |
Reviewer: Jfhutson ( talk · contribs) 21:31, 28 December 2015 (UTC)
This looks like it's probably already at GA standards. Here are my comments:
That'll do for now. I don't know if any of that should hold up the GA. I'll take another look today or tomorrow. My main issue is where the article drifts into specialized subjects without explaining enough for a non-specialist.-- JFH ( talk) 21:31, 28 December 2015 (UTC)
I don't know enough about Wikipedia to find out who wrote the "Iterative approximation" section, but to whoever did, thank you. Algorithms for calculating a logarithm are surprisingly hard to find, and that section was far and away the clearest and most helpful description I've found. I'm sure that I'm using the talk page wrong, so feel free to delete this section, but I just had to express my gratitude. Cormac596 ( talk) 14:47, 1 June 2022 (UTC)
The following Wikimedia Commons file used on this page or its Wikidata item has been nominated for deletion:
Participate in the deletion discussion at the nomination page. — Community Tech bot ( talk) 11:52, 23 August 2022 (UTC)
![]() | Binary logarithm has been listed as one of the
Mathematics good articles under the
good article criteria. If you can improve it further,
please do so. If it no longer meets these criteria, you can
reassess it. Review: December 29, 2015. ( Reviewed version). |
![]() | A fact from Binary logarithm appeared on Wikipedia's
Main Page in the
Did you know column on 6 January 2016 (
check views). The text of the entry was as follows:
| ![]() |
![]() | This ![]() It is of interest to the following WikiProjects: | ||||||||||
|
Where did the algorithm given here come from? I would love to find an original reference for this. Kleg 22:45, 19 July 2006 (UTC)
Same here. I can sort of guess why it works (squaring the scaled input value corresponds to doubling the result), but I would love to see the actual maths behind it.
Math for the result is located at this url: http://en.literateprograms.org/Logarithm_Function_%28Python%29
not a function! A function has a domain, a range, and a graph!
Where does the name lg come from? -- Abdull ( talk) 20:15, 24 July 2008 (UTC)
Isn't there an error in the identity given for integers?
It says:
But surely it should be:
? —Preceding unsigned comment added by 195.27.20.35 ( talk) 12:05, 26 February 2010 (UTC)
Python example is clearly too complex and too long. 1exec1 ( talk) 17:53, 24 April 2010 (UTC)
Then refer to the OLD python code, it is much simpler
#!/usr/bin/python from __future__ import division def log2(X): epsilon = 1.0/(10**12) integer_value=0 while X < 1: integer_value = integer_value - 1 X = X * 2 while X >= 2: integer_value = integer_value + 1 X = X / 2 decfrac = 0.0 partial = 0.5 X=X*X while partial > epsilon: if X >= 2: decfrac = decfrac + partial X = X / 2 partial = partial / 2 X=X*X return (integer_value + decfrac) if __name__ == '__main__': value = 4.5 print " X =",value print "LOG2(X) =",log2(value) # Sample output # # $ python log2.py # X = 4.5 # LOG2(X) = 2.16992500144 #
wouldn't it be nicer code to use
while(n>>=1!=0) ++pos;
instead of
if (n >= 1<<16) { n >>= 16; pos += 16; } if (n >= 1<< 8) { n >>= 8; pos += 8; } if (n >= 1<< 4) { n >>= 4; pos += 4; } if (n >= 1<< 2) { n >>= 2; pos += 2; } if (n >= 1<< 1) { pos += 1; }
? -- 129.247.247.239 ( talk) 11:53, 16 July 2010 (UTC)
Under "Information Theory" the notation lb rather than ld is suddenly used without explanation. Is this a typo? If not, perhaps it should say something like: lg, lx, and lb are sometimes used for base 2 logs.
GA toolbox |
---|
Reviewing |
Reviewer: Jfhutson ( talk · contribs) 21:31, 28 December 2015 (UTC)
This looks like it's probably already at GA standards. Here are my comments:
That'll do for now. I don't know if any of that should hold up the GA. I'll take another look today or tomorrow. My main issue is where the article drifts into specialized subjects without explaining enough for a non-specialist.-- JFH ( talk) 21:31, 28 December 2015 (UTC)
I don't know enough about Wikipedia to find out who wrote the "Iterative approximation" section, but to whoever did, thank you. Algorithms for calculating a logarithm are surprisingly hard to find, and that section was far and away the clearest and most helpful description I've found. I'm sure that I'm using the talk page wrong, so feel free to delete this section, but I just had to express my gratitude. Cormac596 ( talk) 14:47, 1 June 2022 (UTC)
The following Wikimedia Commons file used on this page or its Wikidata item has been nominated for deletion:
Participate in the deletion discussion at the nomination page. — Community Tech bot ( talk) 11:52, 23 August 2022 (UTC)