1// RUN: %clang_builtins %s %librt -o %t && %run %t 2 3//===--------------- truncdfsf2_test.c - Test __truncdfsf2 ----------------===// 4// 5// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 6// See https://llvm.org/LICENSE.txt for license information. 7// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 8// 9//===----------------------------------------------------------------------===// 10// 11// This file tests __truncdfsf2 for the compiler_rt library. 12// 13//===----------------------------------------------------------------------===// 14 15#include <stdio.h> 16 17#include "fp_test.h" 18 19float __truncdfsf2(double a); 20 21int test__truncdfsf2(double a) 22{ 23 float actual = __truncdfsf2(a); 24 float expected = a; 25 26 if (actual != expected) { 27 printf("error in test__truncdfsf2(%lf) = %f, " 28 "expected %f\n", a, actual, expected); 29 return 1; 30 } 31 return 0; 32} 33 34int main() 35{ 36 if (test__truncdfsf2(340282366920938463463374607431768211456.0)) 37 return 1; 38 return 0; 39} 40