mirror of
https://github.com/ml-explore/mlx.git
synced 2025-09-18 10:26:56 +08:00

committed by
GitHub

parent
ef7b8756c0
commit
600db7d754
@@ -18,7 +18,7 @@ struct Remainder {
|
||||
template <typename T> T operator()(T x, T y) { return x % y; }
|
||||
template <> float operator()(float x, float y) { return fmod(x, y); }
|
||||
template <> half operator()(half x, half y) { return fmod(x, y); }
|
||||
template <> bfloat operator()(bfloat x, bfloat y) { return fmod(x, y); }
|
||||
template <> bfloat16_t operator()(bfloat16_t x, bfloat16_t y) { return fmod(x, y); }
|
||||
};
|
||||
|
||||
struct Equal {
|
||||
|
@@ -112,5 +112,7 @@ constexpr complex64_t operator*(complex64_t a, complex64_t b) {
|
||||
}
|
||||
|
||||
constexpr complex64_t operator%(complex64_t a, complex64_t b) {
|
||||
return {fmod(a.real, b.real), fmod(a.imag, b.imag)};
|
||||
auto real = a.real - (b.real * static_cast<int64_t>(a.real / b.real));
|
||||
auto imag = a.imag - (b.imag * static_cast<int64_t>(a.imag / b.imag));
|
||||
return {real, imag};
|
||||
}
|
||||
|
Reference in New Issue
Block a user