Level Sensor Height Change conversion to gallons

I was attempting to only display the gallons in 1/4 gallon increments though

float gallons = measureINches() * 0.125; // or so

gallons = int(gallons *4) / 4.0; // This rounds down to quarter gallons