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はFLOATです