How do I get the average out of 2 items in .rules file

Hello, I have a task where I need to get the average of 2 items in openHab2 to use in a rules file.
These are the items.

Number temp1 "Temperature [%s]"  { mqtt="<[broker:/heating1/temp/temp:state:default]" }
Number temp2 "Temperature [%s]"  { mqtt="<[broker:/heating2/temp/temp:state:default]" }

And I need to write the average of these two into a

var avgTemp

I tried to do it similar like I would do in Processing but it didn’t work.

Here are 2 examples

Group:Number:AVG g "Temperature [%.1f °C]"
Number temp1 "t1 Temperature [%.1f °C]" (g) { mqtt="<[broker:/heating1/temp/temp:state:default]" }
Number temp2 "t2 Temperature [%.1f °C]" (g) { mqtt="<[broker:/heating2/temp/temp:state:default]" }
Number temp3 "t3 Temperature [%.1f °C]"
rule tmp
  System started
  var avgTemp = (temp1.state as DecimalType + temp2.state as DecimalType) / 2
sitemap tmp label="TMP" {
Group item=g
Text  item=temp1
Text  item=temp2
Text  item=temp3

Im gettin the same error.

2018-03-08 17:52:27.461 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'fancy': org.eclipse.smarthome.core.library.types.DecimalType

Fixed the error, but now it gets the value however in sitemapas it just shows ERR

2018-03-08 17:56:10.089 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value ‘19.10000000’ of item temp1switchstate with format ‘%d °C’: java.util.IllegalFormatConversionException: d != java.math.BigDecimal

Ok I fixed that error, but how do i round up the number like 19.5

Ok got it working.

var avgTemp12 = (temp1.state as DecimalType + temp2.state as DecimalType) / 2