Possible truncating of scientific notation by APE server using inlinepush

8 views
Skip to first unread message

pacrook

unread,
May 25, 2012, 7:56:00 PM5/25/12
to APE Project
Trying to push out some data using APE server inlinepush.

If I try and push something like:

http://ape.server:6969?[{"cmd":"inlinepush","params":{"raw":"postmsg","data":{"values":[-4.6E-8,4.3E-8,4.7E-6]},"password":"testpasswd","channel":"testchannel"}}]

the response is okay

[{"time":"1337989224","raw":"pushed","data":{"value":"ok"}}]

but what the browser appears to receive is (watching parameter 'raws'
in function parseResponse of Core.js)

"[{"time":"1337989369","raw":"postmsg","data":{"values":
[-0.000000,0.000000,0.000005]}}]"

which JSON.parse turns into an array [0,0,0.000005]

so it looks like the APE server or 'pushinline' command is unpacking
the scientific notation and truncating it off.

I'd like fix the APE server to pass scientific notation without
changing it. Any pointers where in the server code to look?

Nicolas Guibert

unread,
May 26, 2012, 4:10:07 PM5/26/12
to ape-p...@googlegroups.com
I don't know why this is.

I personnaly ran into Javascript limitation of the size of integer (a bit above 10 to the power 15). I don't know if this is related. It seems the smaller numbers got rounded to 0...

In any case, I would recommend either changing the format of the number before sending it to APE (not sure it makes sense, a number is a number right) yourself or to send them via a string (then on the server to convert the strings to numbers, and hopefully it will work).

Regards.

Nicolas.



2012/5/26 pacrook <pac...@gmail.com>

--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to ape-p...@googlegroups.com
To unsubscribe from this group, send email to
ape-project...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/

Reply all
Reply to author
Forward
0 new messages