Can someone please help me to understand this problem:
I’m trying to assign a negative floating point value, but it seems like I’m not getting the right syntax.
This one works:
val float offTemp = -1 // Temperature offset
rule "some rule"
Item LivingRoomThermostat_SetTemperature changed
then
newTemp = Float::parseFloat(LivingRoomThermostat_SetTemperature.state.toString)
newTemp = newTemp + offTemp
end
and this one works (watch the offTemp value):
val float offTemp = 1.0 // Temperature offset
rule "some rule"
Item LivingRoomThermostat_SetTemperature changed
then
newTemp = Float::parseFloat(LivingRoomThermostat_SetTemperature.state.toString)
newTemp = newTemp + offTemp
end
but this fails (again, watch the offTemp value):
val float offTemp = -1.0 // Temperature offset
rule "some rule"
Item LivingRoomThermostat_SetTemperature changed
then
newTemp = Float::parseFloat(LivingRoomThermostat_SetTemperature.state.toString)
newTemp = newTemp + offTemp
end
and results in
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'some rule': An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.FloatExtensions.operator_plus(float,float) on instance: null
It looks to me as if the value -1.0 is not accepted, therefore the value is null. But how to write a negative floating point value? Where’s my mistake?