Home > Article > Backend Development > PHP printf output format usage sharing
Run result: -1,177777 Program analysis: -1 in the memory unit (stored in complement form) is (1111111111111111)2, and converted to octal number is (177777)8. ③x format: Output integers in unsigned hexadecimal form. Long integers can be output in "%lx" format. You can also specify the field width to output in "%mx" format. ④u format: Output integers in unsigned decimal form. Long integers can be output in "%lu" format. You can also specify the field width to output in "%mu" format. ⑤c format: output one character. ⑥s format: used to output a string. There are several ways to use it
to output 0.333333%. Explanation on single precision and double precision: 1. Single precision number. When output using the %f format character, only the first 7 digits are significant digits and there are 6 decimal digits. 2. When a double precision number is output using the %lf format character, the first 16 digits are valid digits and there are 6 decimal places. |