Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readUInt64BE is not defined! #16

Open
monolithed opened this issue Jul 14, 2015 · 7 comments
Open

readUInt64BE is not defined! #16

monolithed opened this issue Jul 14, 2015 · 7 comments

Comments

@monolithed
Copy link

@ngroup, @creationix

value = bops.readUInt64BE(this.buffer, this.offset + 1);

There's no bops.readUInt64BE in bops

@creationix
Copy link
Owner

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

@monolithed
Copy link
Author

node msgpack-js@0.3.0 with bops@0.1.1

@creationix
Copy link
Owner

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 creationix/bops@cf40315).

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
Copy link
Owner

What's interesting is the node unit tests pass just fine when testing 64-bit numbers. I even recently added more large number tests. d659872

@monolithed
Copy link
Author

Thanks for help!

@didaxRedux
Copy link

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

@08euccs014
Copy link

Any update on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants