They float on pieces of the Earth's outer skin,or crust.
VOA: special.2010.01.12
I need to have a float. I need to have another float here, it's giving me some information.
这儿还需要一个,它给了我这样的信息。
Then I'd be multiplying a float by 5, so that's a float times an int.
然后我们把这个浮点数乘以,那是浮点数乘以整型数。
Each of China's provinces, autonomous regions and special administrative regions contributed a float.
VOA: standard.2009.10.01
It means anybody using that little function get float doesn't have to worry about what's inside of it. So for example, I decide I want to change the message I print out, I don't have to change the function, I just pass in a different parameter.
这代表着用这个方法去获得浮点数,的任何人都不用担心具体的实现了,例如,如果我想改变下,显示的信息的话,我不必去改变方法,我传个不同的参数就可以了。
- And then I divide by an int -- that's okay because so long as you have a float involved at some point early on, you're okay.
然后我除以一个整型数-,那是可以的因为现在为止,我们在之前已经,引入了一个浮点数,你是对的。
OK, it's right here. It's called read float.
好的,就在这里。
That's going to give me a float.
那将会给我们一个浮点数。
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类型允许的更高精度,小数点后更多位数,那你该用什么取代它?
I can't rely on Professor Guttag if I give this- if this code to him, I can't rely on him to type in a float. Actually I can, because he's a smart guy, but in general, I can't rely on the user-- I wouldn't do it right to see if you did.
当Guttag使用这段代码的时候-,我不能相信他一定会输入一个浮点数,实际上我能因为他很聪明,但是总体上来讲,别相信用户一定会按照规则来-,我会故意做错来试试你的程序的。
I if I go over here, and I say float of three, it's going to do the conversion.
用float来处理3,它将能完成装换,但是如果我吧这个转化为浮点数。
Now a float is not 1 byte, it's 4 bytes, or 4 times 8, 32 bits.
而float就不只1字节了,它占据4个字节,或者说32比特。
And I'm storing the answer in a variable called "answer" that's of type float.
我把这个答案存储在一个float类型的,叫做“answer“的变量中。
Ah ha, it goes into that accept portion, prints out a message, and goes back around the while loop to say try again. And it's going to keep doing this until I give it something that does serve as a float.
他会说输入一个浮点数,啊哈,它就到了那段处理代码,打印出消息,然后回到while循环让我们再输一次,它会持续这么做直到它接受到一个浮点数。
应用推荐