float on lcd display

I'd like to display a float value I've obtained by arcane calculations on a 16x2 LCD to only 1 decimal point
rather than the automatic formatting given by lcd.print.......

  • how might I do this?

Thanks for your ideas......

regards

Allan

lcd.print(yourFloat, 1);

It depends a little on the range of the variable. You can get sophisticated about this but you might only need to start with something like
if yourFloat<10.0 then lcd.print(" ")

This is to ensure the decimal is always in the same place, and thereby avoid mysterious second significant figures showing up.

The application is an altimeter and vario based on a BMP280, so the diisplay can be from -30,000 to +30,000
feet , and -20..+20 feet/second.

altitude :
less than abs(10) show to 1dp
abs (10 - 100) no dp
abs (>100) to nearest 10 feet

vario :
1dp fixed.

I'm messing about to get the display I want - the (float,1 ) works perfectly - thanks.

regards

Allan.