通常的经验是,在Android设备中,浮点数会比整型慢两倍,在缺少FPU和JIT的G1上对比有FPU和JIT的Nexus One中确实如此(两种设备间算术运算的绝对速度差大约是10倍)
This is true on a FPU-less, JIT-less G1 and a Nexus One with an FPU and the JIT. (Of course, absolute speed difference between those two devices is about 10x for arithmetic operations.)
它直接把小数点后面的数值丢弃掉了,因为,凭直觉,那些整型数和结果应该是一个浮点数据,但是我需要一个更精确的数值。
It just throws the decimal point away and that's because, again, these are ints and the answer intuitively should be a floating point value, but I need to be more specific.
浮点数和小数不象整数一样“循规蹈矩”,不能假定浮点计算一定产生整型或精确的结果,虽然它们的确“应该”那样做。
Floating point and decimal Numbers are not nearly as well-behaved as integers, and you cannot assume that floating point calculations that "should" have integer or exact results actually do.
除支持基本的字符串之外,您还可以存储布尔值、双精度数、浮点数、整型数、长整型数和字节数组(考虑序列化)。
In addition to basic string support, you can store booleans, doubles, floats, integers, longs, and byte arrays (think serialization).
除支持基本的字符串之外,您还可以存储布尔值、双精度数、浮点数、整型数、长整型数和字节数组(考虑序列化)。
In addition to basic string support, you can store booleans, doubles, floats, integers, longs, and byte arrays (think serialization).
应用推荐