Fixed compile warning in bacnet_strtof() from double fabs() to float FLT_MAX by using same pattern as Channel and Timer objects for float range validation.

This commit is contained in:
Steve Karg
2026-02-10 14:05:50 -06:00
parent a4ba359fde
commit 576cac784e
+9 -9
View File
@@ -1572,10 +1572,10 @@ bool bacnet_strtol(const char *str, long *long_value)
bool bacnet_strtof(const char *str, float *float_value)
{
char *endptr;
double value;
double double_value;
errno = 0;
value = strtod(str, &endptr);
double_value = strtod(str, &endptr);
if (endptr == str) {
/* No digits found */
return false;
@@ -1589,15 +1589,15 @@ bool bacnet_strtof(const char *str, float *float_value)
/* Extra text found */
return false;
}
if (fabs(value) > FLT_MAX) {
/* Value exceeds float range */
return false;
}
if (float_value) {
*float_value = (float)value;
if (isgreaterequal(double_value, -FLT_MAX) &&
islessequal(double_value, FLT_MAX)) {
if (float_value) {
*float_value = (float)double_value;
}
return true;
}
return true;
return false;
}
/**