Division in Scripted field

Painless is basically Java, and your variables are all integers, this is why you are getting zero (it's only doing integer division): Painless integer division

Cast your variables to float before doing the division, then it should work like you expect.