What is displayed when the following is executed
2019独角兽企业重金招聘Python工程师标准>>> 
What is displayed when the following is executed;
double d1=-0.5;
System.out.println("Ceil d1="+Math.ceil(d1));
System.out.println("floor d1="+Math.floor(d1));
-
Ceil d1=-0.0 floor d1=-1.0
-
Ceil d1=0.0 floor d1=-1.0
-
Ceil d1=-0.0 floor d1=-0.0
-
Ceil d1=0.0 floor d1=0.0
-
Ceil d1=0 floor d1=-1
A
- ceil:大于等于 x,并且与它最接近的整数。
- floor:小于等于 x,且与 x 最接近的整数。
- 如果参数小于0且大于-1.0,结果为 -0
转载于:https://my.oschina.net/u/3847203/blog/3015066
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
