Skip to content

Instantly share code, notes, and snippets.

@rwaldron
Created July 30, 2010 14:12
Show Gist options
  • Save rwaldron/500574 to your computer and use it in GitHub Desktop.
Save rwaldron/500574 to your computer and use it in GitHub Desktop.
<script src="caret.js"></script>
;(function () {
var isEven = function (num) {
return +num % 2 === 0 ? true : false;
}
console.clear();
var n = 152, op = '-', atEight = 0;
for ( var i = 0; i < 80; i++ ) {
console.group( n + ' ^ ' + i );
console.log( n ^ i );
console.log( n + ' - ' + ( n ^ i) + ' = ' + ( n - ( n ^ i ) ) );
if ( !(i % 8) ) {
op = op == '+' ? '-' : '+';
}
eval( 'var num = '+ n + ' ' + op + ' ' + i );
console.log( num );
if ( !(i % 8) ) {
if ( i > 1 ) {
atEight++;
}
}
console.groupEnd();
}
/*
for ( var i = 0; i < 20; i++ ) {
console.group('1 ^ ' + i );
console.log( 1 | i );
if ( !isEven(i) ) {
console.log( i );
}
else {
console.log( i + 1 );
}
console.groupEnd();
}
*/
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment