Skip to content

Commit

Permalink
add recip intrinsic
Browse files Browse the repository at this point in the history
  • Loading branch information
neilkichler committed Jul 11, 2024
1 parent e2514f6 commit 57b8441
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions examples/mccormick/mccormick.cu
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ constexpr auto f(auto x, auto y)
// auto a = abs(x);
// auto a = exp(x);
// auto a = log(x);
// auto a = recip(x);
// auto a = pown(x, 3);
// auto a = pown(x, 4);
// auto a = pow(x, 4);
Expand Down
8 changes: 4 additions & 4 deletions include/cutangent/arithmetic/intrinsic.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ namespace cu::intrinsic
// template<> inline __device__ double max (double x, double y) { return fmax(x, y); }
// template<> inline __device__ double copy_sign (double x, double y) { return copysign(x, y); }
template<> inline __device__ tangent<double> next_after(tangent<double> x, tangent<double> y) { return { nextafter(x.v, y.v), x.d }; }
// template<> inline __device__ double rcp_down (double x) { return __drcp_rd(x); }
// template<> inline __device__ double rcp_up (double x) { return __drcp_ru(x); }
template<> inline __device__ tangent<double> sqrt_down(tangent<double> x) { return sqrt(x); }
template<> inline __device__ tangent<double> sqrt_up (tangent<double> x) { return sqrt(x); }
template<> inline __device__ tangent<double> rcp_down (tangent<double> x) { using std::pow; return { __drcp_rd(x.v), - __dmul_rd(pow(x.v, -2.0), x.d) }; }
template<> inline __device__ tangent<double> rcp_up (tangent<double> x) { using std::pow; return { __drcp_ru(x.v), - __dmul_ru(pow(x.v, -2.0), x.d) }; }
template<> inline __device__ tangent<double> sqrt_down (tangent<double> x) { return sqrt(x); }
template<> inline __device__ tangent<double> sqrt_up (tangent<double> x) { return sqrt(x); }
// template<> inline __device__ double int_down (double x) { return floor(x); }
// template<> inline __device__ double int_up (double x) { return ceil(x); }
// template<> inline __device__ double trunc (double x) { return ::trunc(x); }
Expand Down

0 comments on commit 57b8441

Please sign in to comment.