Using 10^() in Logics calculation and Homeyscript results in different values

Continuing the discussion from

Hi all,

I am playing with the formula for absolute humidity, but I wanted to use an Adv. Virtual Device instead of a Virtual Device;
However, the outcome of the formula is then different than with a standard flow chart (Logik or a VD).
The AVD and Homeyscript return the same value, but it is not within 0-100 (the value range for humidity)

When I replace 10^ with 10*, they all do return the same result, which is 13.154246753335052,
10^ is apparently interpreted differently?

How do I now get the same result as with a Logic ‘calculate’ chart?

Formula:

let absHum = 100000 * 18.016/8314.3 * 85 / 100  *  6.1078 * 10^((7.5 * 11 )/(237.3 + 11 ))/( 11 + 273.15);
return absHum;

Screenshot from 2023-10-08 00-58-03

Use ** instead of ^.

MDN.

4 Likes

Thanks Robert!
That solved it :white_check_mark: :partying_face:

let absHum = 100000 * 18.016/8314.3 * 85 / 100  *  6.1078 * 10 ** ((7.5 * 11 )/(237.3 + 11 ))/( 11 + 273.15);
return absHum;