DS18B20 sensor temperature display with 9 bit precision

Gentlemen’s,
I’m developing a small project with three DS18B20 temperature sensors in 9 bit resolution mode and 16x2 LCD display. Using 'OneWire.h' + 'DallasTemperature.h' + 'LiquidCrystal.h' libraries without modification. All works fine.
The issue I have is related to the fact that I have quite limited display space to indicate temperatures (I want to display some other text also). Standard libraries by default shows temperature in format (-)XX.XX, for example 23.50 or 23.00 Celsius . Since I need only 9 bit temp resolutions it would be enough to have one digit after comma, like 23.0 or 23.5 Celsius. That would save me some space on the LCD screen.
Any ideas how to do it in elegant way?
Thank a lot!

float temperature = 4.5267;
char buffer[5];
snprintf(buffer, sizeof(buffer), "%.01f", temperature);

assuming lcd inherits from Print class

float temperatureC = getTempC();

lcd.print(temperature, 1); // for float the param means the # decimals

Thanks a lot! This is super easy way of fixing it! :slight_smile: