You can either have a big number and a small decimal point or small number and a big decimal point.
可以小数点前面长,后面短,或者,前面短,后面长。
It just throws the decimal point away and that's because, again, these are ints and the answer intuitively should be a floating point value, but I need to be more specific.
它直接把小数点后面的数值丢弃掉了,因为,凭直觉,那些整型数和结果应该是一个浮点数据,但是我需要一个更精确的数值。
So, you can understand they really felt quite confident at this time that we could explain everything that was going on and in fact, a really telling quote from the time was said by a professor at the University of Chicago, and what he said is, "Our future discoveries must be looked for in the sixth decimal place."
所以你可以理解,为什么当时的人那么,自信的说我们可以解释,这世界上发生的一起事情,事实上,当时有个著名的名言,是芝加哥大学的一个教授说的,他说“我们今后的科学发现,就在于弄清楚小数点第六位后的数,“
There's no decimal point; there's no point zero; there's no floating point value, it's just a hardcoded integer.
这里没有小数点,这里没有;,这里没有浮点数值,它只是一个整型数字。
You don't need this hack of just, like, manually adding a decimal point just to fix that problem.
你不需要这样来操作,比如,手动地加入小数点来修正这个错误。
So a floating point value again is a number with a decimal point, so it depends.
一个浮点型数据就是一个,带小数点的数。
Glancing at the bottom, this is pretty arbitrary, but I chose to format my string as follows: % 1f so at the bottom here I'm printing out %.1f, which quick sanity check means print just one digit after the decimal place.
看下这个底部,这个是相当随意的,但我选择把我的字符串格式化成这样:,所以在这个底部我打印输出,提醒一下,这是一个只打印出,小数点后一位的方法。
Something with a decimal point and numbers thereafter.
也就是小数点后还有数字。
Everything from the decimal point over gets chopped off.
所有小数点后面的数值都被砍掉了。
If I go back to that code from a moment ago, and I just rerun math3, notice how many places printed after the decimal point -- two?
如果刚才我回到那段代码中去,我们回到math3,请注意在小数点后面,会打印几位数呢--两位?
So it turns out there's a solution to this: If you need more precision, more digits after the decimal point than a float allows, what do you go for instead?
所以这里有一个解决方案:,如果你需要比float类型允许的更高精度,小数点后更多位数,那你该用什么取代它?
应用推荐