We need to be accurate to two decimal places (e.g. in a simple accounting package), scale everything up by 100, and convert it back to floating point as late as possible.
我们处理小数的时候要精心些,比方说我们在做一个简单的统计程序时,要限制结果不能超过100,要尽可能晚的把它转化成浮点数。
In this lab, the student will learn the process to convert hexadecimal values to decimal and binary values.
在这个实验中,同学将学习转换十六进制数值成为十进制及二进制数值的程序。
If you actually want to count the number of decimals, you'd probably have to convert to a string, remove any trailing zeroes, and see where the decimal point landed.
如果你真的要数小数点后的位数,你可能要转换为字符串,删除任何尾随零,看看小数点落在哪里。
应用推荐