Browse Source

* More correct comparison of long double values for case when long double=double in C.

git-svn-id: branches/targetandroid@23485 -
yury 12 years ago
parent
commit
fcbefc94e3
1 changed files with 4 additions and 4 deletions
  1. 4 4
      tests/test/cg/tcalext.pp

+ 4 - 4
tests/test/cg/tcalext.pp

@@ -309,7 +309,7 @@ begin
 
 
   value_long_double := RESULT_LONGDOUBLE;
   value_long_double := RESULT_LONGDOUBLE;
   test_param_longdouble(value_long_double);
   test_param_longdouble(value_long_double);
-  if trunc(global_long_double) <> trunc(RESULT_LONGDOUBLE) then
+  if Abs(RESULT_LONGDOUBLE - global_long_double) > 1E-15 then
     failed := true;
     failed := true;
 {$endif}
 {$endif}
 
 
@@ -406,7 +406,7 @@ begin
 {$ifdef test_longdouble}
 {$ifdef test_longdouble}
   array_long_double[1] := RESULT_LONGDOUBLE;
   array_long_double[1] := RESULT_LONGDOUBLE;
   test_array_param_longdouble(array_long_double);
   test_array_param_longdouble(array_long_double);
-  if trunc(global_long_double) <> trunc(RESULT_LONGDOUBLE) then
+  if Abs(RESULT_LONGDOUBLE - global_long_double) > 1E-15 then
     failed := true;
     failed := true;
 {$endif test_longdouble}
 {$endif test_longdouble}
 
 
@@ -496,7 +496,7 @@ begin
   value_u8bit := RESULT_U8BIT;
   value_u8bit := RESULT_U8BIT;
   value_long_double := RESULT_LONGDOUBLE;
   value_long_double := RESULT_LONGDOUBLE;
   test_param_mixed_long_double(value_long_double, value_u8bit);
   test_param_mixed_long_double(value_long_double, value_u8bit);
-  if global_long_double <> value_long_double then
+  if Abs(RESULT_LONGDOUBLE - global_long_double) > 1E-15 then
     failed := true;
     failed := true;
   if global_u8bit <> RESULT_U8BIT then
   if global_u8bit <> RESULT_U8BIT then
     failed := true;
     failed := true;
@@ -726,7 +726,7 @@ begin
   clear_globals;
   clear_globals;
 
 
   value_long_double := test_function_longdouble;
   value_long_double := test_function_longdouble;
-  if trunc(value_long_double) <> trunc(RESULT_LONGDOUBLE) then
+  if Abs(RESULT_LONGDOUBLE - value_long_double) > 1E-15 then
     failed := true;
     failed := true;
 {$endif}
 {$endif}