Absolute value


I am currently trying to get the absolute value of the difference of two humidity sensors


rule "Bathroom Fan"
        Item BathHumSensor changed
        logDebug("debugrules", "Bathroom Humidity = " + BathHumSensor.state)  // check the value of humidity and print it in the logs
        logDebug("debugrules", "Bathroom Difference = " + Math::abs(BathHumSensor.state - BurHumSensor.state))
        if (Math::abs(BathHumSensor.state-BurHumSensor.state) > 10 && BathFan.state != ON) {
                sendCommand(BathFan, ON)
                logDebug("debugrules", "Fan is set to ON")
        else if (Math::abs(BathHumSensor.state-BurHumSensor.state) <= 10 && BathFan.state == ON) {
                sendCommand(BathFan, OFF)
                logDebug("debugrules", "Fan is set to OFF")

The first logDebug line works
The second one with the absolute value calculation does not work. That tells me that there is a problem with the abs function and the way I use it.

Can somebody point me to the right direction ?


Edit: Actually there is no point doing what I did. Humidity in the bathroom will be always higher compared to the rest of the house when taking a bath so absolute value does not have any benefit. But it would be nice to know what I am doing wrong anyway

You usually need to cast Number Items as e.g. DecimalType or suchlike to use with maths libraries.