Cypher Arithmatic Errors on Long Integers #2009

Closed
ThingsHybrid opened this Issue Feb 19, 2014 · 9 comments

Projects

None yet

6 participants

@ThingsHybrid

When doing arithmetic operations on big integers, particularly 64 bit long integer, there seems to be random errors on results. Examples are as follows:

23367415295377408 + 4294967295000 = 23371710262672410
1392806488 * 16777216 = 23367415295377410

Bizarrely, 1392806488 * 16777217 = 23367416688183896 gives the correct answer.

@freeeve
Contributor
freeeve commented Feb 20, 2014

RETURN 1392806488.0 * 16777216.0 gives the bad 23367415295377410 also.

@davidegrohmann
Contributor

I guess you are using a REST point and a webpage for rendering the results, since in the neo4j shell shows the correct result.

About the REST API, if you look at the raw HTTP response content the result is the expected one.
It seems JS does not handle big number properly. :(

Try this in a JS console:
$ 23371710262672408
result: 23371710262672410

@ThingsHybrid

Hello,
I executed the Cypher query from localhost:7474/browser. Does it still use java underneath from that webpage?

On Feb 21, 2014, at 10:58 AM, Davide Grohmann notifications@github.com wrote:

I guess you are using a REST point and a webpage for rendering the results, since in the neo4j shell shows the correct result.

About the REST API, if you look at the raw HTTP response content the result is the expected one.
It seems JS does not handle big number properly. :(

Try this in a JS console:

23371710262672408
23371710262672410


Reply to this email directly or view it on GitHub.

@akollegger
Member

@ThingsHybrid Neo4j Browser is implemented in javascript, so can have issues rendering results correctly.

@ThingsHybrid

The weird thing is, if you change the perfectly 0x1000000 slightly to something else, the result is correct not sure if it is problem with js internal formality since it works with other big ints.

On Feb 21, 2014, at 10:58 AM, Davide Grohmann notifications@github.com wrote:

I guess you are using a REST point and a webpage for rendering the results, since in the neo4j shell shows the correct result.

About the REST API, if you look at the raw HTTP response content the result is the expected one.
It seems JS does not handle big number properly. :(

Try this in a JS console:

23371710262672408
23371710262672410


Reply to this email directly or view it on GitHub.

@freeeve
Contributor
freeeve commented Feb 21, 2014

Nice catch Davide. I was testing in console.neo4j.org. You're right that it works in the shell. I just added some tests to my HTTP client package and it seems to work with the JSON interface there as well. Phew!

@freeeve
Contributor
freeeve commented Feb 21, 2014

I was worried for a minute that the HTTP API would be messing up the JSON as well, but this satisfied me: freeeve/cq@e5abffa

@ThingsHybrid

It's all good :-) thanks!!

On Feb 21, 2014, at 1:00 PM, Wes Freeman notifications@github.com wrote:

Nice catch Davide. I was testing in console.neo4j.org. You're right that it works in the shell. I just added some tests to my HTTP client package and it seems to work with the JSON interface there as well. Phew!


Reply to this email directly or view it on GitHub.

@boggle
Member
boggle commented Jun 10, 2014

Waiting for resolution of issue #2028

@boggle boggle closed this Jun 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment