mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-09-27 04:27:25 +00:00
Remove situations where we're comparing floats with == (Fixes #819)
This commit is contained in:
@@ -134,7 +134,7 @@ def compile(file, defines = [])
|
||||
if $cfg[:tools][:test_compiler][:executable] =~ /gcc/
|
||||
$cfg[:tools][:test_compiler][:arguments] |= ['-Wno-misleading-indentation']
|
||||
end
|
||||
cmd_str = build_command_string($cfg[:tools][:test_compiler], [file, out_file], defines)
|
||||
cmd_str = build_command_string($cfg[:tools][:test_compiler], [file, out_file], defines)
|
||||
execute(cmd_str)
|
||||
out_file
|
||||
end
|
||||
|
||||
+8
-4
@@ -445,13 +445,17 @@ void UnityPrintFloat(const UNITY_DOUBLE input_number)
|
||||
}
|
||||
|
||||
/* round to nearest integer */
|
||||
n = ((UNITY_INT32)(number + number) + 1) / 2;
|
||||
{
|
||||
UNITY_DOUBLE two_number = number + number;
|
||||
UNITY_INT32 two_n_trunc = (UNITY_INT32)two_number;
|
||||
n = (two_n_trunc + 1) / 2;
|
||||
|
||||
#ifndef UNITY_ROUND_TIES_AWAY_FROM_ZERO
|
||||
/* round to even if exactly between two integers */
|
||||
if ((n & 1) && (UNITY_ABS((UNITY_DOUBLE)n - number - 0.5f) < epsilon))
|
||||
n--;
|
||||
/* round to even if exactly between two integers */
|
||||
if ((n & 1) && (two_n_trunc & 1) && !((UNITY_DOUBLE)two_n_trunc < two_number))
|
||||
n--;
|
||||
#endif
|
||||
}
|
||||
|
||||
n += n_int;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user