1// RUN: %clang_builtins %s %librt -o %t && %run %t
2// REQUIRES: librt_has_truncdfsf2
3
4#include <stdio.h>
5
6#include "fp_test.h"
7
8float __truncdfsf2(double a);
9
10int test__truncdfsf2(double a)
11{
12 float actual = __truncdfsf2(a);
13 float expected = a;
14
15 if (actual != expected) {
16 printf(format: "error in test__truncdfsf2(%lf) = %f, "
17 "expected %f\n", a, actual, expected);
18 return 1;
19 }
20 return 0;
21}
22
23int main()
24{
25 if (test__truncdfsf2(a: 340282366920938463463374607431768211456.0))
26 return 1;
27 return 0;
28}
29

source code of compiler-rt/test/builtins/Unit/truncdfsf2_test.c