//===----------------------------------------------------------------------===//
//
// Part of the CUDA Toolkit, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.
//
//===----------------------------------------------------------------------===//

// MIT License
//
// Modifications Copyright (C) 2026 Advanced Micro Devices, Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#ifndef _CUDA_STD_CMATH
#define _CUDA_STD_CMATH

#include <cuda/std/detail/__config>

#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
#  pragma GCC system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)
#  pragma clang system_header
#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)
#  pragma system_header
#endif // no system header

#include <cuda/std/__host_stdlib/math.h>

#if _CCCL_COMPILER(NVHPC)
#  include <cmath>
#endif // _CCCL_COMPILER(NVHPC)

#include <cuda/std/__cmath/abs.h>
#include <cuda/std/__cmath/copysign.h>
#include <cuda/std/__cmath/error_functions.h>
#include <cuda/std/__cmath/exponential_functions.h>
#include <cuda/std/__cmath/fdim.h>
#include <cuda/std/__cmath/fma.h>
#include <cuda/std/__cmath/fpclassify.h>
#include <cuda/std/__cmath/gamma.h>
#include <cuda/std/__cmath/hyperbolic_functions.h>
#include <cuda/std/__cmath/hypot.h>
#include <cuda/std/__cmath/inverse_hyperbolic_functions.h>
#include <cuda/std/__cmath/inverse_trigonometric_functions.h>
#include <cuda/std/__cmath/isfinite.h>
#include <cuda/std/__cmath/isinf.h>
#include <cuda/std/__cmath/isnan.h>
#include <cuda/std/__cmath/isnormal.h>
#include <cuda/std/__cmath/lerp.h>
#include <cuda/std/__cmath/logarithms.h>
#include <cuda/std/__cmath/min_max.h>
#include <cuda/std/__cmath/modulo.h>
#include <cuda/std/__cmath/nan.h>
#include <cuda/std/__cmath/remainder.h>
#include <cuda/std/__cmath/roots.h>
#include <cuda/std/__cmath/rounding_functions.h>
#include <cuda/std/__cmath/signbit.h>
#include <cuda/std/__cmath/traits.h>
#include <cuda/std/__cmath/trigonometric_functions.h>
#include <cuda/std/__cstdlib/abs.h>
#include <cuda/std/limits>
#include <cuda/std/version>

#if _CCCL_FREESTANDING()
#  define INFINITY ::cuda::std::numeric_limits<float>::infinity()
#  define NAN      ::cuda::std::numeric_limits<float>::quiet_NaN()
#endif // _CCCL_FREESTANDING()

#include <cuda/std/__cccl/prologue.h>

_CCCL_BEGIN_NAMESPACE_CUDA_STD

#if _CCCL_FREESTANDING()

using double_t = double;
using float_t  = float;

#else // ^^^ _CCCL_FREESTANDING() ^^^ / vvv _CCCL_HOSTED() vvv

using ::double_t;
using ::float_t;

#endif // _CCCL_HOSTED()

_CCCL_END_NAMESPACE_CUDA_STD

#include <cuda/std/__cccl/epilogue.h>

#endif // _CUDA_STD_CMATH
