-
Notifications
You must be signed in to change notification settings - Fork 105
Introduce "safe" float comparison #99
Description
Introduce a safe form of comparing floating point. == and != should not be used when comparing floating numbers.
./HandmadeMath.h:854:31: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y); ~~~~~~ ^ ~~~~~~~ ./HandmadeMath.h:854:52: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y); ~~~~~~ ^ ~~~~~~~ ./HandmadeMath.h:861:31: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z); ~~~~~~ ^ ~~~~~~~ ./HandmadeMath.h:861:52: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z); ~~~~~~ ^ ~~~~~~~ ./HandmadeMath.h:861:73: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z); ~~~~~~ ^ ~~~~~~~ ./HandmadeMath.h:868:31: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z && Left.W == Right.W); ~~~~~~ ^ ~~~~~~~ ./HandmadeMath.h:868:52: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z && Left.W == Right.W); ~~~~~~ ^ ~~~~~~~ ./HandmadeMath.h:868:73: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z && Left.W == Right.W); ~~~~~~ ^ ~~~~~~~ ./HandmadeMath.h:868:94: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] hmm_bool Result = (Left.X == Right.X && Left.Y == Right.Y && Left.Z == Right.Z && Left.W == Right.W);