Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
floatの計算には誤差がつきもの
float valueA = 0.1f;
float added = 0;
for (int i = 1; i <= 10; i++)
{
added += valueA;
}
float targetValue = 1.0f;
if (added == targetValue)
{
// こちらを通って欲しいのに
}
else
{
// こっちに来ちゃうんですよねぇ……。
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment