ESPhome height sensor - % full of cylindrical oil tank

So I have got a D1 mini with ESPhome working as a height sensor in my oil tank. At the moment it feeds back the height of the oil to HA but what I would like to do is account for the shape of the tank (cylinder on its side) and to give a % full value, as just using the height will overestimate the amount of oil once below 50%. The equation to do so is: Capture

L = length of tank (150cm)
R = radius of tank (110cm)
D = height of liquid (variable)

I can simplify most of the equation as L and R are static but would this be possible for ESPhome to make the calculation and what would the formatting be for the yaml?

Has anyone done this successfully in an easier way?