How to change rounding in cypher query

I've the following in a query:

RETURN (3/5)*100 as total

current output: 0

desired output: 0.6

The problem is that it rounds decimal numbers to the lowest integer, so this way I can never compute a percentage. Does anyone know how to change this?

Hello @fhol :slight_smile:

There are several ways:

RETURN (3.0 / 5.0) * 100 AS total
RETURN (toFloat(3) / toFloat(5)) * 100 AS total


@Cobra Such a newbie question but really helpful for a beginner, thanks!

1 Like

No problem, I'm happy to help, there are no bad questions :slight_smile:

1 Like