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.
基本的に、2 つの変数があります。
double halfWidth = Width / 2; double halfHeight = Height / 2;
それらは 2 で除算されるため、整数または小数のいずれかになります。それらが整数か.5かどうかを確認するにはどうすればよいですか?
を使用できますmodf。これで十分です。
modf
double intpart; if( modf( halfWidth, &intpart) == 0 ) { // your code here }