How to print a float with 3 decimal places

I can not figure out the syntax to print a float that has 3 decimal places. I found this very useful snippet of code to get a float value from a keypad:

      while (1) { //get digits
        byte digit = checkKeyBuffer(); //get a keypress from the user
        if (digit >= 0 && digit <= 9) { //a digit
          if (DP == 0) {
            Entry = Entry * 10;
            Entry = Entry + digit;
          }
          if (DP > 0) {
            digit = digit / pow(10, DP);
            digit = Entry + digit;
            DP = DP + 1;
          }
          break;
        }
        else if (digit == keyAsterisk) { //decimal point
          DP = 1;
          break;
        }
      } //end while getting digits

To print it to my LCD I tried something like this:

sprintf(theBuffer, "%03d", Entry);
disp.lcd_print(theBuffer);

But this doesn't print anything to the right of the decimal. Is there a simple way to do this?

"%d" is for integers, but %f does not work on arduino for space reasons. try dtostrf().

Or, if myFraction = 1.0 / 3.0 = .33333, you could use:

Serial.println(myFraction, 3);

The problem is not only in the printing!
The problem is also at this line "digit = Entry + digit;".
This is correct: "Entry = Entry + digit;".

Line before, "digit = digit / pow(10, DP);", is also wrong, result is "float" assigned to "byte".
The working code is:

float tempfloat = digit / pow(10, DP);
Entry = Entry + tempfloat;

Better is replace these two lines by this one:
Entry = digit / pow(10, DP) + Entry;

amiga4000:
The problem is not in the printing!

Really?
I thought I read

I can not figure out the syntax to print a float that has 3 decimal places

Nick_Pyner:
Really?

Sort of. @SouthernAtHeart does have a bug in the posted code that prevents Entry from accumulating anything to the right of the decimal.