このコードは
このコードは、2つのfloat(浮動小数点)値間の等しいかどうかのテストのような比較を実行する。
を考慮しない比較演算子を使用しています。
を使用しています。
浮動小数点値を使った数値計算
は、丸め誤差のために不正確な結果を生成する可能性がある。
その結果、2つの異なる計算が
その結果、2つの異なる計算が、数学的には等しいが、ビット表現がわずかに異なる数値を生成することがある。
ビット表現が微妙に異なるため、数学的に等しい値には変換されない。
数学的に等しい値には変換されません。 その結果
テストやその他の比較で予期せぬ
結果を出すかもしれない。
The code performs a comparison such as an
equality test between two float (floating point) values, but
it uses comparison operators that do not account for the
possibility of loss of precision.
Numeric calculation using floating point values
can generate imprecise results because of rounding errors.
As a result, two different calculations might generate
numbers that are mathematically equal, but have slightly
different bit representations that do not translate to the
same mathematically-equal values. As a result, an equality
test or other comparison might produce unexpected
results.