larryllix Posted August 11, 2016 Posted August 11, 2016 Since v5.xx now has decimal value representation, a nice operator to have add to ISY would be Integer() that returns the whole number of a compound number The syntax could be something done like this (in the same flavour as existing operators) $whole.number i- $compound.number eg. $compound.number = 123.456 $whole.number i= $compound.number $whole.number == 123 is True This could save a few lines of x / 10^n * 10^n to extract Integers from compound numbers. Thanks!
Chris Jahn Posted August 11, 2016 Posted August 11, 2016 That's a good suggestion. We should probably add fraction() to get the number after the decimal as an integer as well. I'll see what we can do.
larryllix Posted August 11, 2016 Author Posted August 11, 2016 That's a good suggestion. We should probably add fraction() to get the number after the decimal as an integer as well. I'll see what we can do. '%=' already generates a modulus function extracting the fractional part, as a fraction. A fractional function resulting in a whole number would return strange results. modulus(123.456) would result in 0.456 frac(123.456) would result in 456.000 frac(123.4560001) would result in 4560001.000 Maybe I missed the concept usefulness. Or, perhaps there is no way around the user needing to control how many decimals they want. The decimal variables are not floating point and that is probably a very good thing in HA/control systems.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.