[manual] FORMAT$ %F length documentation is wrong.
Root / SmileBASIC Bug Reports / [.]
12Me21Created:
The %F format code generates floating point numbers. The manual says that you can specify the length of the parts before and after the decimal. For example, %3.3F should display 3 digits before the decimal place, and 3 after. However the first argument is actually the TOTAL length, so the previous example must be written as %7.3F.
It appears the number between % and . is not ignored, but it's not what the documentation says it should be, either. It is a minimum width, in characters, of the output. So, FORMAT$("%7.2F",10/3) gives " 3.33" (three leading spaces to bring the total number of characters up to 7).
Ah, ok. I wonder if this is a bug in SB, or just a mistake in the manual.
I also found another similar mistake. If you put a space between the % and the number, it just inserts that space into the result. In the manual it says to put a space there to tell it to insert spaces (rather than 0s) before the number, but actually it just does that by default.
EDIT: I'm pretty sure this is intentional, and the manual is incorrect, since this is how printf() does it.