Calculating the volume of a square tank or vertical cylinder is a about the limit of my Math skills. embarrassingly it's been 25 years since i used cos or square root.

Could someone offer some insight on how to translate this equation into C++?

This is referenced via this page: http://mathworld.wolfram.com/HorizontalCylindricalSegment.html

In case someone is interested in understanding why.. i have an unusual shape domestic heating oil tank and wish to use an HC-SR4 to measure the quantity of oil.

Thanks to all involved in supporting arduino.