|
1. | That is, you can do anything with a BigInteger or BigDecimal that you can with an int or float, it's just that you must use method calls instead of operators. |
| 也就是说,能对int或float做的事情,对BigInteger和BigDecimal一样可以做。 只是必须使用方法调用,不能使用运算符。 |
|
|
| |
2. | }float naturalLogBase() { return 2.718f; |
| }float naturalLogBase() { return 2.718; |
|
|
| |
3. | 3、 为什么潜水艇既能浮在水面,又能潜入水底? |
| Why can a submarine float and sink? |
|
|
| |
4. | Upper or lowercase L means long, upper or lowercase F means float and upper or lowercase D means double. |
| 若为大写或小写的L,代表long; 大写或小写的F,代表float; 大写或小写的D,则代表double。 |
|
|
| |
5. | However, with float f4 = 1e-47f; |
| 然而,对于下述语句:float f4 = 1e-47f; |
|
|
| |
6. | prints a String, the pInt( ) prints a String followed by an int and the pFlt( ) prints a String followed by |
| 我们注意到的第一件事情就是用于打印(显示)的一些快捷方法:prt()方法打印一个String; pInt()先打印一个String,再打印一个int; 而pFlt()先打印一个String,再打印一个float |
|
|
| |
7. | if you multiply a float and a double, the result will be double; |
| 若将一个float值与一个double值相乘,结果就是double; |
|
|
| |
8. | So the answer is that casting from a float or double to an integral value always truncates. |
| 所以答案就是:将一个float或double值造型成整数值后,总是将小数部分“砍掉”,不作任何进位处理。 |
|
|
| |
9. | For instance, if you assign an integral value to a floating-point variable, the compiler will automatically convert the int to a float. |
| 例如,假设我们为浮点变量分配一个整数值,计算机会将int自动转换成float。 |
|
|
| |
10. | the compiler normally takes exponential numbers as doubles, so without the trailing f it will give you an error telling you that you must use a cast to convert double to float. |
| 编译器通常会将指数作为双精度数(double)处理,所以假如没有这个尾随的f,就会收到一条出错提示,告诉我们须用一个“造型”将double转换成float。 |
|
|
| |