mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-19 08:09:36 +08:00
Add fmod(half, half).
This is to support TensorFlow's `tf.math.floormod` for half.
This commit is contained in:
parent
14b7ebea11
commit
f612df2736
@ -729,6 +729,9 @@ EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half ceil(const half& a) {
|
||||
return half(::ceilf(float(a)));
|
||||
#endif
|
||||
}
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half fmod(const half& a, const half& b) {
|
||||
return half(::fmodf(float(a), float(b)));
|
||||
}
|
||||
|
||||
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half (min)(const half& a, const half& b) {
|
||||
#if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530) || \
|
||||
|
@ -268,6 +268,11 @@ void test_basic_functions()
|
||||
VERIFY_IS_EQUAL(float(log1p(half(0.0f))), 0.0f);
|
||||
VERIFY_IS_APPROX(float(numext::log1p(half(10.0f))), 2.3978953f);
|
||||
VERIFY_IS_APPROX(float(log1p(half(10.0f))), 2.3978953f);
|
||||
|
||||
VERIFY_IS_APPROX(numext::fmod(half(5.3f), half(2.0f)), half(1.3f));
|
||||
VERIFY_IS_APPROX(fmod(half(5.3f), half(2.0f)), half(1.3f));
|
||||
VERIFY_IS_APPROX(numext::fmod(half(-18.5f), half(-4.2f)), half(-1.7f));
|
||||
VERIFY_IS_APPROX(fmod(half(-18.5f), half(-4.2f)), half(-1.7f));
|
||||
}
|
||||
|
||||
void test_trigonometric_functions()
|
||||
|
Loading…
x
Reference in New Issue
Block a user