- Platform information:
- Hardware: 4 Intel CPU_CPUs, 8GB RAM
- OS: Debian 10
- Java Runtime Environment: OpenJDK 11
- openHAB version: 3.2.0

**Problem description:**

I want to multiply float values in a rule but get the following error message:

`Script execution of rule with UID 'KG_Heizraum_Heizung-2' failed: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.FloatExtensions.operator_multiply(float,float) on instance: null in KG_Heizraum_Heizung`

The code is as follows:

```
val Functions$Function1 < GenericItem, Float > nvlFloat = [ theItem |
var Float theValue = 0.0f
if (theItem.state != NULL) theValue = theItem.getStateAs(DecimalType).floatValue
theValue
]
...
val Float DAR = nvlFloat.apply(I_KG_Heizraum_Heizung_Aussentemperatur) - nvlFloat.apply(I_KG_Heizraum_Keller_TemperaturNormalSoll)
val Float expectedInletTemp = nvlFloat.apply(I_KG_Heizraum_Keller_TemperaturNormalSoll) + nvlFloat.apply(I_KG_Heizraum_Keller_KennlinieNiveau)
- nvlFloat.apply(I_KG_Heizraum_Keller_KennlinieNeigung) * DAR * (1.4347f + 0.021f * DAR + 0.0002479f * DAR * DAR)
```

I found out, that the error originates from the terms where a constant float value is multiplied with the Float variable `DAR`

. If I comment out those terms, the error message does not appear:

```
val Float DAR = nvlFloat.apply(I_KG_Heizraum_Heizung_Aussentemperatur) - nvlFloat.apply(I_KG_Heizraum_Keller_TemperaturNormalSoll)
val Float expectedInletTemp = nvlFloat.apply(I_KG_Heizraum_Keller_TemperaturNormalSoll) + nvlFloat.apply(I_KG_Heizraum_Keller_KennlinieNiveau)
- nvlFloat.apply(I_KG_Heizraum_Keller_KennlinieNeigung) * DAR * (1.4347f /*+ 0.021f * DAR + 0.0002479f * DAR * DAR*/)
```

Strange enough, the multiplication of `DAR`

with the first float variable in the parenthesis works, though.

Can anyone please explain me what is wrong?

Best regards,

Stefan D.

=====================================================

P.S.: I experimented a little bit to come closer to the issue, but I still donâ€™t understand it.

Above calculation does not throw the error when I change the definition of `DAR`

to:

```
val Float DAR = (nvlFloat.apply(I_KG_Heizraum_Heizung_Aussentemperatur) - nvlFloat.apply(I_KG_Heizraum_FBHZ_TemperaturNormalSoll)).floatValue
```

So it must be something with return of my function? However, if use the original definition of `DAR`

and change my function to the following, I again get the error:

```
val Functions$Function1 < GenericItem, Float > nvlFloat = [ theItem |
var Float theValue = 0.0f
if (theItem.state != NULL) theValue = theItem.getStateAs(DecimalType).floatValue
theValue.floatValue
]
```

So somehow the subtraction of the two return values of the function seem to do something to the `DAR`

variable to make it incompatible with the multiply function in the next statementâ€¦