22 Fév
2011
22 Fév
'11
15:56
Overall the code is really well done and clear. However here is some issues I ran into: bignum_from_js: Using ">>" and "&" breaks when n is not representable on 32 bits, see 11.7.2 and 11.10 in ECMAScript 5. Ex: d8> Math.pow(2,30) >> 29 2 d8> Math.pow(2,32) >> 31 0 Bitwise arithmetic in javascript is done on 32 bits integer. That means we cannot create a bignum from a js number which takes more than 32 bits to represent. bignum_mod: In javascript, the sign of the result is the sign of the dividend, see 11.5.3 (ES 5). For uniformity, I think we might want to stick to the same convention. Erick