Showing results for 
Search instead for 
Did you mean: 

Multiplication with floats in Neo4j 4.2.7

Hi everyone,

I just updated my database to 4.2.7. When running my software I encountered a weird problem with multiplication of numbers which is probably best explained in pictures:


So, apparently there is something wrong with float values and multiplication, since the error does not come up when only adding two floats or multiplying two floats (e.g. 1.0+2.0 or 1.0*2.0).



Confirmed in 4.2.8 too

as you updated my database to 4.2.7 I presume this was successfully working on a prior version?
my testing is such that I get the following results when run via cypher-shell

Neo4j Version      Response
4.0.3                       1.0
4.1.6                       1.0
4.2.8  / 4.3.1          Invalid input '(': expected "+" or "-" (line 1, column 10 (offset: 9))
"return 2*(2.0-1.5);"

further investigating the change in behavior

Thanks for reporting, seems the new parser handles unary / binary - incorrectly.

Only happens for negative floating point numbers in a subtraction, i.e. return 0-1.0

You can work around while it's being fixed by inserting a space after the minus, e.g. return 0- 1.0

Thank you @dana.canzano for reporting back!

Thanks for the workaround, Michael. This will help me continue for now.

Yes, this was working before.

Nodes 2022
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.