aboutsummaryrefslogtreecommitdiff
path: root/cbits/arith.c
diff options
context:
space:
mode:
Diffstat (limited to 'cbits/arith.c')
-rw-r--r--cbits/arith.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cbits/arith.c b/cbits/arith.c
index db88588..c984255 100644
--- a/cbits/arith.c
+++ b/cbits/arith.c
@@ -46,6 +46,7 @@ typedef int64_t i64;
#define GEN_POW(x, y) _Generic((x), float: powf, double: pow)(x, y)
#define GEN_LOGBASE(x, y) _Generic((x), float: logf(y) / logf(x), double: log(y) / log(x))
+#define GEN_ATAN2(y, x) _Generic((x), float: atan2f(y, x), double: atan2(y, x))
#define GEN_EXP(x) _Generic((x), float: expf, double: exp)(x)
#define GEN_LOG(x) _Generic((x), float: logf, double: log)(x)
#define GEN_SQRT(x) _Generic((x), float: sqrtf, double: sqrt)(x)
@@ -456,6 +457,7 @@ enum fbinop_tag_t {
case FB_DIV: oxarop_op_fdiv_ ## typ ## _sv_strided(rank, shape, out, x, strides, y); break; \
case FB_POW: oxarop_op_pow_ ## typ ## _sv_strided(rank, shape, out, x, strides, y); break; \
case FB_LOGBASE: oxarop_op_logbase_ ## typ ## _sv_strided(rank, shape, out, x, strides, y); break; \
+ case FB_ATAN2: oxarop_op_atan2_ ## typ ## _sv_strided(rank, shape, out, x, strides, y); break; \
default: wrong_op("fbinary_sv_strided", tag); \
} \
} \
@@ -464,6 +466,7 @@ enum fbinop_tag_t {
case FB_DIV: oxarop_op_fdiv_ ## typ ## _vs_strided(rank, shape, out, strides, x, y); break; \
case FB_POW: oxarop_op_pow_ ## typ ## _vs_strided(rank, shape, out, strides, x, y); break; \
case FB_LOGBASE: oxarop_op_logbase_ ## typ ## _vs_strided(rank, shape, out, strides, x, y); break; \
+ case FB_ATAN2: oxarop_op_atan2_ ## typ ## _vs_strided(rank, shape, out, strides, x, y); break; \
default: wrong_op("fbinary_vs_strided", tag); \
} \
} \
@@ -472,6 +475,7 @@ enum fbinop_tag_t {
case FB_DIV: oxarop_op_fdiv_ ## typ ## _vv_strided(rank, shape, out, strides1, x, strides2, y); break; \
case FB_POW: oxarop_op_pow_ ## typ ## _vv_strided(rank, shape, out, strides1, x, strides2, y); break; \
case FB_LOGBASE: oxarop_op_logbase_ ## typ ## _vv_strided(rank, shape, out, strides1, x, strides2, y); break; \
+ case FB_ATAN2: oxarop_op_atan2_ ## typ ## _vv_strided(rank, shape, out, strides1, x, strides2, y); break; \
default: wrong_op("fbinary_vv_strided", tag); \
} \
}
@@ -597,6 +601,7 @@ INT_TYPES_XLIST
NONCOMM_OP_STRIDED(fdiv, /, typ) \
PREFIX_BINOP_STRIDED(pow, GEN_POW, typ) \
PREFIX_BINOP_STRIDED(logbase, GEN_LOGBASE, typ) \
+ PREFIX_BINOP_STRIDED(atan2, GEN_ATAN2, typ) \
UNARY_OP_STRIDED(recip, 1.0/, typ) \
UNARY_OP_STRIDED(exp, GEN_EXP, typ) \
UNARY_OP_STRIDED(log, GEN_LOG, typ) \