fixing macos and windows CI ? x3

This commit is contained in:
2024-09-14 13:04:43 +02:00
parent 30e07d1f1a
commit 429bd9eabd
3 changed files with 30 additions and 20 deletions

View File

@@ -147,27 +147,37 @@ namespace mlx
}
};
template<typename T>
void SinCos(T x, T* sin, T* cos)
{
double s, c;
::sincos(x, &s, &c);
#ifdef MLX_PLAT_LINUX
template<typename T>
void SinCos(T x, T* sin, T* cos)
{
double s, c;
::sincos(x, &s, &c);
*sin = static_cast<T>(s);
*cos = static_cast<T>(c);
}
template<>
inline void SinCos(float x, float* s, float* c)
{
::sincosf(x, s, c);
}
*sin = static_cast<T>(s);
*cos = static_cast<T>(c);
}
template<>
inline void SinCos(long double x, long double* s, long double* c)
{
::sincosl(x, s, c);
}
template<>
inline void SinCos(float x, float* s, float* c)
{
::sincosf(x, s, c);
}
template<>
inline void SinCos(long double x, long double* s, long double* c)
{
::sincosl(x, s, c);
}
#else
template<typename T>
void SinCos(T x, T* sin, T* cos)
{
*sin = std::sin(x);
*cos = std::cos(x);
}
#endif
}
template<AngleUnit Unit, typename T>

View File

@@ -47,7 +47,7 @@
#include <iterator>
#include <stb_truetype.h>
#include <variant>
#if defined(MLX_PLAT_MACOS) || defined(MLX_PLAT_LINUX) || defined(MLX_PLAT_UNIX)
#if defined(MLX_PLAT_LINUX)
#include <math.h> // sincos
#endif