Tags
algorithmmath
Created
Nov 21, 2018 2:18 PM
https://techiedelight.quora.com/Top-25-Programming-Puzzles-and-Brain-Teasers
半加法逻辑:
function add(a, b) {
if (!b) return a;
const sum = a ^ b; // 异或。对等位相加,没有进位
const carry = (a & b) << 1; // 进位
return add(sum, carry)
}
使用对数:Math.log(Math.exp(10) * Math.exp(20))