Dim ThermostatDegrees As Float = 1.5
Dim MaxErrorPercent As Float = 1.33
Dim MaxErrorDegrees As Float = Abs(ThermostatDegrees * MaxErrorPercent / 100)
Dim CurrentTemperatureDegrees As Float = 2.24568
If Abs(CurrentTemperatureDegrees - ThermostatDegrees) < MaxErrorDegrees Then
Log("within bounds") 'temperature is within 1.33% of thermostat setting
Log("(ie between " & (ThermostatDegrees - MaxErrorDegrees) & " and " & (ThermostatDegrees + MaxErrorDegrees) & " degrees)")
Else
Log("sound the klaxon")
End If