Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
此代码不起作用。有什么建议么?
float tempNum = 0.590000; int temporary; if (tempNum >= 0.590000 && tempNum <= 0.610000){ temporary = 15; } // temporary yields zero
所以:
默认情况下 0.590000 是DOUBLE
所以float tempNum = 0.59000导致演员表。
float tempNum = 0.59000
为了证明这一点,请尝试:
float tempNum = 0.590000f; int temporary; if (tempNum >= 0.590000f && tempNum <= 0.610000f){ temporary = 15; }
所以,请记住:
aaa.aaa是一个DOUBLE
aaa.aaaf是浮动的