diff --git a/Marlin/macros.h b/Marlin/macros.h index 351272804..b098597c5 100644 --- a/Marlin/macros.h +++ b/Marlin/macros.h @@ -55,7 +55,8 @@ #endif #define RADIANS(d) ((d)*M_PI/180.0) #define DEGREES(r) ((r)*180.0/M_PI) -#define HYPOT(x,y) sqrt(sq(x)+sq(y)) +#define HYPOT2(x,y) (sq(x)+sq(y)) +#define HYPOT(x,y) sqrt(HYPOT2(x,y)) // Macros to contrain values #define NOLESS(v,n) do{ if (v < n) v = n; }while(0) @@ -124,4 +125,8 @@ #define MAX3(a, b, c) max(max(a, b), c) #define MAX4(a, b, c, d) max(max(max(a, b), c), d) +#define UNEAR_ZERO(x) ((x) < 0.000001) +#define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001) +#define NEAR(x,y) NEAR_ZERO((x)-(y)) + #endif //__MACROS_H