Formatting numbers in rule

I have formatting working in the .items file but now want to move it to a rule.
The following rule does not work as it should, I’m probably missing something important :wink:
Please advise.

rule "PressureProxy"
when
   Item PressureSensor received update
then
   var float Pressure_mmmm = (PressureSensor.state as DecimalType) / 1.3332239
   val int Pressure_mm = String::format("%.0f", Pressure_mmmm)
   postUpdate(PressureProxy,Pressure_mm)   
end

That was probably a bad idea. Ended up with the following:

rule "PressureProxy"
when
   Item PressureSensor received update
then
   var int Pressure_mm = (((PressureSensor.state as DecimalType) / 1.3332239) + 0.5).intValue
   postUpdate(PressureProxy,Pressure_mm)   
end