FastLED 3.9.15
Loading...
Searching...
No Matches

◆ FL_DISABLE_WARNING() [2/2]

FL_DISABLE_WARNING_PUSH fl::FL_DISABLE_WARNING ( unused- function)

Definition at line 42 of file json.cpp.

43 {
44
45
46 auto isnan = [](double value) -> bool {
47 return value != value;
48 };
49
50 // Check for special values
51 if (isnan(value)) {
52 return true; // These can be represented as float
53 }
54
55 // Check if the value is within reasonable float range
56 // Reject values that are clearly beyond float precision (beyond 2^24 for integers)
57 // or outside the float range
58 if (fl::fl_abs(value) > 16777216.0) { // 2^24 - beyond which floats lose integer precision
59 return false;
60 }
61
62 // For values within reasonable range, allow conversion even with minor precision loss
63 // This handles cases like 300000.14159 which should be convertible to float
64 // even though it loses some precision
65 return true;
66}
T fl_abs(T value)
Definition math_macros.h:11

References fl_abs().

+ Here is the call graph for this function: