I want to calculate n√X (n root of X) in Teiid query.
S= n√X Where n= 1.89 & x is any input value
Looking at internet article I wrote below query Nth root of a number
for both of the queries I am getting same error. Any thoughts how we can execute above formula ?
The power function expects a double and 1/1.89 is bigdecimal. Teiid treats the conversion of bigdecimal/numeric to double as potentially narrowing, which will depend on the exact value. In this case unfortunately a cast is needed -
SELECT POWER(27, cast(1/1.89 as double))
You can see there is slight difference in the values:
SELECT 1/cast(1.89 as double) = 1/1.89