creationix / msgpack-js

The msgpack protocol implemented in pure javascript.
http://msgpack.org/
MIT License
253 stars 48 forks source link

readUInt64BE is not defined! #16

Open monolithed opened 9 years ago

monolithed commented 9 years ago

@ngroup, @creationix

https://github.com/creationix/msgpack-js/blob/9b601f13526e6a8bb649de510649336021836b5e/msgpack.js#L129

There's no bops.readUInt64BE in bops

creationix commented 9 years ago

Which version of bops are you using? Is this in the browser or in node?

monolithed commented 9 years ago

node msgpack-js@0.3.0 with bops@0.1.1

creationix commented 9 years ago

Interesting. I can see the browser version of bops is missing the 64-bit variants because the underlying dataview doesn't support them (though I just added uint64 functions in https://github.com/creationix/bops/commit/cf403158a5d943047c95242ba7239357ef74fff5).

But the node side of bops just calls through to node's buffer API. I guess node doesn't support 64 bit ops either. https://github.com/creationix/bops/blob/master/read.js

It's not hard to implement 64-bit reading for uint (just do two 32-bit reads and multiple one by 0x100000000). It's a little harder for signed integers.

Also you do know that JavaScript numbers cannot precisely hold 64-bit integers? There are only about 53 bits of precision in JS numbers. Anything larger than that will loose precision when converted to a JS number.

creationix commented 9 years ago

What's interesting is the node unit tests pass just fine when testing 64-bit numbers. I even recently added more large number tests. https://github.com/creationix/msgpack-js/commit/d6598723cc0e6ed15b455a402b85c0c92e7117de

monolithed commented 9 years ago

Thanks for help!

didaxRedux commented 8 years ago

I've encountered the same problem. Reading yours answers I did not understand how to solve this error...

08euccs014 commented 6 years ago

Any update on it.