If you don't mind a compiled solution, my "ref" module adds the
(read|write)Int64[BL]E functions to the Buffer object:
https://github.com/TooTallNate/ref. You can pass in String representations
of the int64 values and they will be dealt with in C-land.

On Wed, Jan 16, 2013 at 6:47 AM, Ben Noordhuis <[email protected]> wrote:

> On Wed, Jan 16, 2013 at 11:25 AM, Cheng Shao <[email protected]> wrote:
> > I'm trying out nodejs as a TCP server. i want to read unsigned 64bit
> integer
> > from Buffer. find not similar function. why not to be added?
>
> JS numbers are 64 bits doubles.  That means you can't represent 64 bit
> integers with them because they're only exact for integers up to 2^53.
>
> To illustrate:
>
>   $ node
>   > Math.pow(2, 53) === Math.pow(2, 53) - 1
>   false
>   > Math.pow(2, 53) === Math.pow(2, 53)
>   true
>   > Math.pow(2, 53) === Math.pow(2, 53) + 1
>   true
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to