LCD.print to 3 decimal places

Hi, I am trying to include a if/else statement in a LCD.print routine, so that if the value (realPower) is equal or more than 1000, then it prints Power 1.325 KW (to 3 decimal places).
If it's lower then it prints Power 325 Watts.
The below code works, except that the 'if' statement only prints to 2 decimal places, and I get Power 1.32 KW

 lcd.clear();
    lcd.setCursor(0, 0);
    if (ch1.realPower >= 1000)  {
      lcd.print("Power "); lcd.print(ch1.realPower / 1000); lcd.print(" KW");  }
    else  {
      lcd.print("Power "); lcd.print(ch1.realPower,0); lcd.print(" Watts");  }

I have tried lcd.print(ch1.realpower,3 / 1000) and get 0KW
and lcd.print((ch1.realpower,3) / 1000) and get 0KW

Any suggestions?

try ch1.realPower/1000.0

lcd.print(ch1.realPower / 1000.0, 3)

The pedant in me wishes you’d use “kW” and “W” instead of “KW” and “Watts”. :slight_smile:

oscarBravo:

lcd.print(ch1.realPower / 1000.0, 3)

The pedant in me wishes you'd use "kW" and "W" instead of "KW" and "Watts". :slight_smile:

Thanks, this works fine.
Agree with you re the kW, but keeping the Watts!