diff --git a/examples/mccormick/mccormick.cu b/examples/mccormick/mccormick.cu index fcf0532..9f13b20 100644 --- a/examples/mccormick/mccormick.cu +++ b/examples/mccormick/mccormick.cu @@ -35,7 +35,10 @@ constexpr auto f(auto x, auto y) // auto a = log(x); // auto a = recip(x); // auto a = cos(x); - auto a = tanh(x); + // auto a = tanh(x); + auto a = atan(x); + // auto a = asin(x); + // auto a = acos(x); // auto a = pown(x, 3); // auto a = pown(x, 4); // auto a = pow(x, 4); diff --git a/include/cutangent/arithmetic/basic.cuh b/include/cutangent/arithmetic/basic.cuh index d63aeff..e9160b7 100644 --- a/include/cutangent/arithmetic/basic.cuh +++ b/include/cutangent/arithmetic/basic.cuh @@ -103,6 +103,30 @@ fn tangent operator/(tangent a, tangent b) return { a.v / b.v, (a.d * b.v - a.v * b.d) / (b.v * b.v) }; } +template +fn tangent operator/(T a, tangent b) +{ + return { a / b.v, (-a * b.d) / (b.v * b.v) }; +} + +template +fn tangent operator/(tangent a, T b) +{ + return { a.v / b, a.d / b }; +} + +template +fn tangent operator/(std::integral auto a, tangent b) +{ + return { a / b.v, (-a * b.d) / (b.v * b.v) }; +} + +template +fn tangent operator/(tangent a, std::integral auto b) +{ + return { a.v / b, a.d / b }; +} + template fn tangent max(tangent a, tangent b) {