xref: /llvm-project/flang/runtime/Float128Math/nearest.cpp (revision fc51c7f0cc1abf1679100d71d103fe5d943f580b)
1 //===-- runtime/Float128Math/nearest.cpp ----------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "math-entries.h"
10 
11 namespace Fortran::runtime {
12 extern "C" {
13 
14 #if HAS_LDBL128 || HAS_FLOAT128
15 CppTypeFor<TypeCategory::Real, 16> RTDEF(Nearest16)(
16     CppTypeFor<TypeCategory::Real, 16> x, bool positive) {
17   return Nextafter<true>::invoke(
18       x, positive ? F128_RT_INFINITY : -F128_RT_INFINITY);
19 }
20 #endif
21 
22 } // extern "C"
23 } // namespace Fortran::runtime
24