Home | History | Annotate | Download | only in Unit
      1 //===--------------- truncdfsf2_test.c - Test __truncdfsf2 ----------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is dual licensed under the MIT and the University of Illinois Open
      6 // Source Licenses. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file tests __truncdfsf2 for the compiler_rt library.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #include <stdio.h>
     15 
     16 #include "fp_test.h"
     17 
     18 float __truncdfsf2(double a);
     19 
     20 int test__truncdfsf2(double a)
     21 {
     22     float actual = __truncdfsf2(a);
     23     float expected = a;
     24 
     25     if (actual != expected) {
     26         printf("error in test__truncdfsf2(%lf) = %f, "
     27                "expected %f\n", a, actual, expected);
     28         return 1;
     29     }
     30     return 0;
     31 }
     32 
     33 int main()
     34 {
     35     if (test__truncdfsf2(340282366920938463463374607431768211456.0))
     36         return 1;
     37     return 0;
     38 }
     39