Wednesday, 15 June 2011

javascript - Doing math on UInt64 is unwrapping it -



javascript - Doing math on UInt64 is unwrapping it -

i have var blah = ctypes.uint64('65'), 65 anything. need math on that, when do:

console.log(blah * ctypes.uint64('2') removes ctypes.uint64 wrap. need maintain wrap can pass else, know can re-wrap it, whats proper way math on uint64 , int64 please.

there no api/library math on js-ctypes int64 types.

you'll need disclose , re-wrap needed , of course of study plenty error checking , handling know when safe disclose stuff , math operations might lose precision (>53bit) and/or overflow numbers.

if cannot utilize regular js double precision float math, because need 64-bit, you'll need read on bignum math , how small-numbers, or find suitable bignum library. however, numbers illustration not require this.

and avoid doing int64 math in first place, if possible; of course, not possible.

javascript firefox-addon jsctypes

No comments:

Post a Comment