Fast numerical manipulation in JavaScript