11#ifndef _CU_ARITHMETICS_CU_IS_EQUAL_H_
12#define _CU_ARITHMETICS_CU_IS_EQUAL_H_
21#include "../_cu_definitions/cu_types.h"
54 template <
typename DataType>
71 #if defined(USE_CUDA_FP8_E5M2) && (USE_CUDA_FP8_E5M2 == 1)
96 #if defined(USE_CUDA_FP8_E4M3) && (USE_CUDA_FP8_E4M3 == 1)
121 #if defined(USE_CUDA_FP16) && (USE_CUDA_FP16 == 1)
143 #if defined(USE_CUDA_BF16) && (USE_CUDA_BF16 == 1)
165 #if defined(USE_CUDA_FP32) && (USE_CUDA_FP32 == 1)
169 if (std::fabs(
x -
y) <= 2.0 * std::numeric_limits<float>::epsilon())
194 #if defined(USE_CUDA_FP64) && (USE_CUDA_FP64 == 1)
198 if (std::fabs(
x -
y) <= 2.0 * std::numeric_limits<double>::epsilon())
Cast from float to __half and __nv_bfloat16 types and vice-versa, and float to double and vice-versa.
__host__ __device__ DataType abs(const DataType x)
Absolute value of a floating point number.
bool is_equal(DataType x, DataType y)
Check if two floating point numbers are equal within a tolerance.