Python format output example (decimal integer output)

Source File

f = 1.6
print("1.6 direct integer output is %d"%f,end="\n")
print("1.6 uses the precision range of floating-point numbers to output %.0f"%f)

output

1.6 Direct integer output is 1
1.6 Using the precision range of floating-point numbers to output 2

in conclusion

It is directly turned into an integer output, and the mantissa is directly discarded.

The precision display is rounded.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325871754&siteId=291194637