Why can’t we do Uint64 class inside Math namespace to be used for all the 64-bit arithmetic operations?
Like:
var x = Math.Uint64(2);
var y = Math.Uint64.fromString(“0x12345678abcdef01”);
var z = x.mul(y); // or Math.Uint64.mul(x, y)
var z_hi = z.hi; // highest 32-bit part
var z_lo = z.lo; // lowest 32-bit part
var z_val = Number(z); // or z.valueOf(), returns IEEE.754-compatible float64 number when possible (with highest possible precision, so no loss up to +-2^52)
Such syntax looks not so “low-level” for JS devs, should be easily polyfilled by current engines and optimized by new ones.
,
Ingvar Stepanyan.
Why can’t we do Uint64 class inside Math namespace to be used for all the 64-bit arithmetic operations?
Like:
var x = Math.Uint64(2);
var y = Math.Uint64.fromString(“0x12345678abcdef01”);
var z = x.mul(y); // or Math.Uint64.mul(x, y)
var z_hi = z.hi; // highest 32-bit part
var z_lo = z.lo; // lowest 32-bit part
var z_val = Number(z); // or z.valueOf(), returns IEEE.754-compatible float64 number when possible (with highest possible precision, so no loss up to +-2^52)
Such syntax looks not so “low-level” for JS devs, should be easily polyfilled by current engines and optimized by new ones.
Regards,
Ingvar Stepanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131104/5edefd96/attachment.html>
Why can’t we do Uint64 class inside Math namespace to be used for all the 64-bit arithmetic operations?
Like:
var x = Math.Uint64(2);
var y = Math.Uint64.fromString(“0x12345678abcdef01”);
var z = x.mul(y); // or Math.Uint64.mul(x, y)
var z_hi = z.hi; // highest 32-bit part
var z_lo = z.lo; // lowest 32-bit part
var z_val = Number(z); // or z.valueOf(), returns IEEE.754-compatible float64 number when possible (with highest possible precision, so no loss up to +-2^52)
Such syntax looks not so “low-level” for JS devs, should be easily polyfilled by current engines and optimized by new ones.
, Ingvar Stepanyan.