{% is surrounding regular code {{ is the return of the code | float will ensure that you convert the state into a float number | round(0) will remove everything after the decimal point

In HA states.sensor is all sensors states, then it is yours that we pick.

The math behind is up-to-you but think about it with your exemples and one of mine

In the last exemple, 1.6 multiplied by 2 will get over 3 that will lead to 1.5 as the final result
On the other hand, 1.4 doesn’t, it will be 2.8 that will later become 2 and then 1. You got the idea, right?

Like so, if your sensor is unknown or undefined, it will be replaced by 0 and the remaining of the computation will succeed, otherwise, multiplying and dividing will fail.