Fix rounding errors for range node when using float inputs and integer outputs

And add extra tests
This commit is contained in:
Dave Conway-Jones
2025-08-28 15:18:02 +01:00
parent 9ad329e5a1
commit 7b51f30d11
2 changed files with 12 additions and 0 deletions

View File

@@ -24,6 +24,10 @@ module.exports = function(RED) {
this.maxin = Number(n.maxin);
this.minout = Number(n.minout);
this.maxout = Number(n.maxout);
if (this.round) {
this.maxout = Math.floor(this.maxout);
this.minout = Math.ceil(this.minout);
}
this.property = n.property||"payload";
var node = this;