Skip to content

Comments

Consider inf/nan when validating float ranges.#3

Open
kape1395 wants to merge 1 commit intobacnet-ex:masterfrom
kape1395:fix-float-validation
Open

Consider inf/nan when validating float ranges.#3
kape1395 wants to merge 1 commit intobacnet-ex:masterfrom
kape1395:fix-float-validation

Conversation

@kape1395
Copy link

In some cases, the min/max boundaries for floats are :infn and :inf. These cases have to be considered.
Not sure if such validation conforms to the standard.
Also, I don't know if the value itself can be inf/infn/nan. In such a case, the validation has to be adjusted further.

@gitneko
Copy link

gitneko commented Feb 20, 2026

Thanks for the PR!

I have never seen so far NaN/Inf+/Inf- for REAL properties in the wild so far, but I haven't worked with every possible BACnet device yet. :)

The BACnet specification simply refers to IEEE single and double precision floating points, so non-numbers are definitely possible for all REAL properties (such as the value itself). There's no explicit statement against it. So that case would need to be handled aswell.

For me the following are missing for the new function:

  • Docs
  • Typespec
  • Tests (and "integration tests" for the analog objects that the min/max validation works properly)
  • And since there is more than one clause one function head for "pretty" variables in the docs (def float_validator_fun(value, object) works just fine)

Once you tackle these points, I'll check it out locally and if everything is OK, I will merge it.

Once again, thanks for your work and the time you put into using and improving this project.

@gitneko gitneko added the enhancement New feature or request label Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants