As mentioned above here’s the documentation about it: Variant - Xojo Documentation under Automatic conversion of values
Variants used in an expression convert themselves to the type of the other operand, no matter what kind of data they contain, instead of deferring the type-conversion until runtime.
So in:
Var DuskSensor As Integer = Dictionary_Temperature.Value("Dusk Sensor")*100
the value from Dictionary_Temperature.Value("Dusk Sensor")
will be an Integer as you’re using 100 (integer) instead of 100.0 (double). 0.25 as an integer will be 0 so you’ve got 0*100 = 0
The correct way would be:
Var DuskSensor As Integer = Dictionary_Temperature.Value("Dusk Sensor").DoubleValue * 100
as double * integer will be worked out as a double then the answer of that converted to an integer to store in the DuskSensor variable.
or
Var DuskSensor As Integer = Dictionary_Temperature.Value("Dusk Sensor") * 100.0
so you have double * double with the answer being converted to an Integer
The reason why:
System.DebugLog "Dusk Sensor % = "+ Format(Dictionary_Temperature.Value(“Dusk Sensor”),”##%”)
works is because you’re always working with a double (what is stored in the dictionary and what Format expects) and never going near an Integer.
Where as:
System.DebugLog "Dusk Sensor Integer= "+ Str(Dictionary_Temperature.Value("Dusk Sensor")*100)
is again converting Dictionary_Temperature.Value("Dusk Sensor")
to an Integer because you’re multiplying by an integer.