英文:
Why don't I get any decimal place when dividing by e.g. 1000000000
问题
所以,我试图通过将整数/长整数(如37800)除以1000来移动逗号,然后将结果保存到一个浮点数中。
float shift;
shift = 37800 / 1000;
在这个例子中,我得到了37.0
。
发生了什么?为什么小数部分被删除了?
英文:
So, I'm trying to shift the comma of an int/long like 37800 by dividing it by e.g. 1000, and saving this then into a float.
float shift;
shift = 37800/1000;
As a result I get 37.0
in this example.
What is happening there? Why do they get deleted?
专注分享java语言的经验与见解,让所有开发者获益!
评论