Talk:Find first and last set bit of a long integer: Difference between revisions

→‎Errors: new section
(→‎More Clarification "set bit": re: what motivates you to find ''bits'' in it... add http://nanochess.110mb.com/chess3.html#algol)
(→‎Errors: new section)
Line 79:
 
C has given us << ''left'' shift and >> ''right'' shift operators for '''int''', '''long int''', and '''long long int'''. Clearly C knows the difference between left and right. That could be a good starting point. [[User:NevilleDNZ|NevilleDNZ]] 04:31, 8 December 2011 (UTC)
 
== Errors ==
 
The C example goes one power too far and runs into problems with losing the MSB. Minor correction needed though; it's not the core task itself that is wrong.
 
The Algol 68 example though, I cannot see how those figures (especially the LSB) could possibly be correct on a machine that uses binary digits. They are just wildly off. I don't know ''exactly'' what's wrong, but I truly don't believe them. Or are they counting from the other end? That'd just be weird given that virtually everyone numbers bits from the LSB, as that gives consistent answers for small integers irrespective of the size of machine integers being used. –[[User:Dkf|Donal Fellows]] 09:01, 8 December 2011 (UTC)
Anonymous user