Minh Nguyen / ArduinoJson
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers math.hpp Source File

math.hpp

00001 // ArduinoJson - arduinojson.org
00002 // Copyright Benoit Blanchon 2014-2021
00003 // MIT License
00004 
00005 #pragma once
00006 
00007 #include <ArduinoJson/Namespace.hpp>
00008 
00009 namespace ARDUINOJSON_NAMESPACE {
00010 
00011 // Some libraries #define isnan() and isinf() so we need to check before
00012 // using this name
00013 
00014 #ifndef isnan
00015 template <typename T>
00016 bool isnan(T x) {
00017   return x != x;
00018 }
00019 #endif
00020 
00021 #ifndef isinf
00022 template <typename T>
00023 bool isinf(T x) {
00024   return x != 0.0 && x * 2 == x;
00025 }
00026 #endif
00027 }  // namespace ARDUINOJSON_NAMESPACE