No such thing as a small change | |
PerlMonks |
Re^3: decimal to binary conversionby BrowserUk (Patriarch) |
on May 31, 2015 at 08:43 UTC ( [id://1128460]=note: print w/replies, xml ) | Need Help?? |
What is it about the value '255' that allows the program to work correctly ? 255 has all ones. Thus if the program tests the same bit and prints 1, 8 times it just looks like it worked. It didn't. Any value that has the first bit set will also produce a 1:
Using the OPs original code, the fact that only the first bit is being tested becomes obvious when you enter a 1:
And the fact that 255 appeared to work, is just coincidence. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked
In Section
Seekers of Perl Wisdom
|
|