Temperature conversion again

I use this to use my temperature items in rules:

temperature = (mytempitem.state as Number).floatValue

This works but in other topics I found this:

temperature = (mytempitem.state as Number).doubleValue

Does this make any difference or is one better than the other?
I have also read about bigDecimal, but don’t know how to use them.
Is there a best conversion for a number:temperature item to a number variable?

See the first table on this page:

Unless you’re performing advanced science experiments with your temperatures, Float values will provide you with more than enough precision!

(In the grand scheme of things, though, it doesn’t matter which you use)

Hey Reinhard,

at the end all type casts are depending on what you like to achieve. For temperature values in my opinion there is no real difference but float should be sufficient. Typically temperature are somthing like 12,5°C and the precision should be enough.

Technically, if you use the previous methods you’ll get a numeric in whatever units the Item happens to hold at the time.
There are ways to ensure you get exactly what you want, i.e. force the value into C say

var YourNumericInC = (yourTempItem.state as QuantityType<Temperature>).toUnit("°C").toBigDecimal

but in general it is better to do your maths using quantities with units, rather than trying to isolate the numeric part only.