Adds radians and degrees (#1011)

This commit is contained in:
Aneesh Shetty
2024-04-22 13:17:49 -05:00
committed by GitHub
parent 3d405fb3b1
commit d0dbfe0b97
7 changed files with 120 additions and 1 deletions

View File

@@ -2192,6 +2192,16 @@ array arctanh(const array& a, StreamOrDevice s /* = {} */) {
a.shape(), dtype, std::make_shared<ArcTanh>(to_stream(s)), {input});
}
array degrees(const array& a, StreamOrDevice s /* = {} */) {
auto dtype = at_least_float(a.dtype());
return multiply(a, array(180.0 / M_PI, dtype), s);
}
array radians(const array& a, StreamOrDevice s /* = {} */) {
auto dtype = at_least_float(a.dtype());
return multiply(a, array(M_PI / 180.0, dtype), s);
}
array log(const array& a, StreamOrDevice s /* = {} */) {
auto dtype = at_least_float(a.dtype());
auto input = astype(a, dtype, s);