Comparing temperatures in the right way

The following returns a string, I think: {{(states.sensor.foo_json.attributes["temperature"])}}

The documentation recommends using something like states(<???>)|float in order to get a float out and using a function (not the states object), but using plain subsititution doesn’t work, so what are the semantics? How should I compare temperatures?

One way

"{{ states('sensor.mytemp1') | float(0) >= states('sensor.mytemp2') | float(0) }}"

#                                                           <=  if you need less than
#                                                           ==  equal