[英]New to Java Android Studio, need some guidance
i'm new here and to Java Android Studio. 我是新来的和Java Android Studio。
Currently i creating an App which functions as below : 目前我正在创建一个App,其功能如下:
So far i'm stuck at the calculation which is For Example : 到目前为止,我仍然坚持计算,例如:
int x = 1131;
double x1 = x / 80.0; //Gets 14.1375
double x2 = Math.floor(x1); //Gets 14.0
double x3 = x1 - x2; //14.1375 - 14.0 = 0.1374999999999993 ???
something weird shows up during the Math.floor, it suppose to take 14 and execute x1 - x2 ( 14.1375 - 14.0 = 0.1375 ) 在Math.floor中出现一些奇怪的东西,它假设需要14并执行x1 - x2(14.1375 - 14.0 = 0.1375)
But instead it shows 0.1374999999999993 但相反它显示0.1374999999999993
Thank you !! 谢谢 !!
This is because numbers in computer languages are represented by binary. 这是因为计算机语言中的数字由二进制表示。 See the answer posted here
看到这里发布的答案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.