What can Node.js do that ASP.NET cannot?

Packing floating point in NodeJS under 32 bit produces incorrect results - why?

  • I am using the following "pack" function provided by the excellent php.js project. http://github.com/kvz/phpjs/blob/master/functions/misc/pack.js Running this in Mozilla's JavaScript shell it works fine, but running it in Node produces incorrect strings. example, packing the number 2 as a Double with: pack('d',2); JS Shell produces: 00 00 00 00 00 00 00 40 (This is correct, PHP produces the same, and it is reversible) NodeJS produces: 00 00 00 00 00 00 10 00 (This is incorrect) Note all tests run on the same machine (CentOS 5 32 bit) Have I built NodeJS wrongly?

  • Answer:

    There are a number of pack/unpack libraries available for node.  Have you tried any of the others? I'd also suggest opening an issue on the author's github issue tracker.

Matt Ranney at Quora Visit the source

Was this solution helpful to you?

Other answers

Reinstalling with latest version Node v0.1.101 has improved matters, it is coping with integers, but is still failing on floating points

Tim Whitlock

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.