Skip to content

Commit fe268e6

Browse files
committed
Prevent signed-flip on positive at the expense of leaving -0.0F
1 parent a736a95 commit fe268e6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cores/esp8266/Arduino.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ void optimistic_yield(uint32_t interval_us);
217217
// undefine stdlib's definitions when encountered, provide abs that supports floating point for C code
218218
#ifndef __cplusplus
219219
#undef abs
220-
#define abs(x) ({ __typeof__(x) _x = (x); _x > 0 ? _x : -_x; })
220+
#define abs(x) ({ __typeof__(x) _x = (x); _x >= 0 ? _x : -_x; })
221221
#undef round
222222
#define round(x) ({ __typeof__(x) _x = (x); _x >= 0 ? (long)(_x + 0.5) : (long)(_x - 0.5); })
223223
#endif // ifndef __cplusplus

0 commit comments

Comments
 (0)