将浮点数舍入到最近的整数? [英] Round a Floating Point Number Down to the Nearest Integer?
本文介绍了将浮点数舍入到最近的整数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
简单的
print int(x)
也可以。 >
As the title suggests, I want to take a floating point number and round it down to the nearest integer. However, if it's not a whole, I ALWAYS want to round down the variable, regardless of how close it is to the next integer up. Is there a way to do this?
解决方案
Simple
print int(x)
will work as well.
这篇关于将浮点数舍入到最近的整数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文