/src/arduinojson/src/ArduinoJson/Polyfills/math.hpp
Line | Count | Source |
1 | | // ArduinoJson - https://arduinojson.org |
2 | | // Copyright © 2014-2025, Benoit BLANCHON |
3 | | // MIT License |
4 | | |
5 | | #pragma once |
6 | | |
7 | | #include <ArduinoJson/Namespace.hpp> |
8 | | |
9 | | ARDUINOJSON_BEGIN_PRIVATE_NAMESPACE |
10 | | |
11 | | // Some libraries #define isnan() and isinf() so we need to check before |
12 | | // using this name |
13 | | |
14 | | #ifndef isnan |
15 | | template <typename T> |
16 | 1.58k | bool isnan(T x) { |
17 | 1.58k | return x != x; |
18 | 1.58k | } |
19 | | #endif |
20 | | |
21 | | #ifndef isinf |
22 | | template <typename T> |
23 | 1.58k | bool isinf(T x) { |
24 | 1.58k | return x != 0.0 && x * 2 == x; |
25 | 1.58k | } |
26 | | #endif |
27 | | ARDUINOJSON_END_PRIVATE_NAMESPACE |