Application Configuration - performing Exponential arithmetic


I have two bytes arriving from my node and I am trying to perform the calculation 2^^bytes[0] * bytes[1] with JS in the Application Configuration. ie bytes[1] is the mantissa and bytes[0] is the exponential term.

I have tried two different methods and both result in an error
(2 ** bytes[0]) * bytes[1]
Math.pow(2,bytes[0]) * bytes[1]

Is it possible to calculate Exponentials in the Application Configuration? If so, could someone point me to the correct syntax.


I’ve just read that the Application Configuration is based on ECMAScript 5 is also known as ES5 and ECMAScript 2009.

On a JS site I can see Exponential Arithmetic was introduced in ECMAScript 6 (also known as ES6 and ECMAScript 2015).

Based on that, it looks like I’m going to have to go to Plan B and perform the calculation another way.

The equation I am calculating is “var result = 2^^bytes[0] * bytes[1]”
In this case the power to base 2 is the same as left shifting by the number contained in bytes[0], so the equation could be rewritten something like “var result = (1<< bytes[0]) * bytes[1]”

However there is one further simplification which can be applied (and it works)

“var result = bytes[1] << bytes[0]”