Page 1 of 1

Event value as unsigned int

Posted: 19 Mar 2022, 17:41
by mackowiakp
Is it possible to take value of event in rule as unsigned integer from given value?

Re: Event value as unsigned int

Posted: 19 Mar 2022, 17:55
by ThomasB
Have you tried using the [int#n] syntax? I believe it is signed, but avoids float. You can use a rule to handle negative values.

- Thomas

Re: Event value as unsigned int

Posted: 19 Mar 2022, 18:07
by mackowiakp
[int#n] stands for integer (signed). Of course It is possible to eliminate minus from number in rule. But is any direct way?

Re: Event value as unsigned int

Posted: 19 Mar 2022, 23:35
by TD-er
mackowiakp wrote: 19 Mar 2022, 17:41 Is it possible to take value of event in rule as unsigned integer from given value?
See also the abs conversion: https://espeasy.readthedocs.io/en/lates ... ht=abs#abs

Code: Select all

let,1,%eventvalue1%
let,2,abs(%eventvalue1%)
logentry,"This is the integer representation: [int#1]"
logentry,"This is as unsigned int: [int#2]"

Re: Event value as unsigned int

Posted: 19 Mar 2022, 23:43
by mackowiakp
Wow! I haven't found the "abs" function anywhere in the documentation. Well, as you can see, it's my mistake.
Thanks TD-er!