User Tools

Site Tools


λ Javascript math

======= Algorithm ======= <syntax js> var x = 9007199254740992; var y = -x; // x == x + 1 console.log("x = "+x); console.log("x+1 = "+(x+1)); // y == y - 1 console.log("y = "+y); console.log("y-1 = "+(y-1)); // Arithmetic operators work, but bitwise/shifts only operate on int32: console.log("x/2 = "+(x/2)); console.log("x>>1 = "+(x>>1)); console.log("x|1 = "+(x|1)); </syntax> ======= Support ======= <syntax js> // support code </syntax> ======= Tests ======= <syntax js> </syntax> ======= Options ======= <syntax js> { "title":"Javascript math", "height": "250px" } </syntax> ======= Visualisation ======= <syntax html> <html> <head> <style> pre {display:block} </style> <script> function globals() { return { console: { log:function($ret, $prev, str) { if (typeof str === "undefined") { $ret(undefined, $prev); } else { var msg = document.createElement("pre"); msg.innerHTML = "> " + str; document.body.appendChild(msg); var newPrev = function() { document.body.removeChild(msg); $prev(); } $ret(undefined, newPrev); } } } }; } function update(n, x) { } </script> </head> <body> </body> </html> </syntax>

algorithm/javascript-math.txt · Last modified: 2015/02/02 08:28 (external edit)