error C2666: 'snex::hmath::pow': ove rloaded functions have similar conversions
-
I'm pretty sure I'm doing something stupid, but I'm unable to use Math.pow in my node.
I've made a simple example with just a Math Expression node and the formula:output = input*(Math.abs(input) + value)/(Math.pow(input,2.0) + (value-1.0)*Math.abs(input) + 1.0);
The node works as expected in HISE, but compiling the network as dll gives the error:
error C2666: 'snex::hmath::pow': ove rloaded functions have similar conversions
Anyone spot an error?
-
@Dan-Korneff That's because of a mismatch between double and single precision values. The math functions exist in two variants, but if you call a function with one single precision and one double precision argument it might not be able to resolve which function to use.
If you're using the
expr
node, then theinput
will be single precision (because the audio signal is always 32bit float) and thevalue
parameter is double precision (because all parameters in scriptnode are double precision.The yellow light also indicates that there is a compiler warning and if you click on the debug symbol, you can see the warning with some pointers on what to do.
Just cast the inputs so that they are consistently typed:
input*(Math.abs(input) + value)/(Math.pow(input,2.0f) + (value-1.0f)*Math.abs(input) + 1.0f);
-
-
@Christoph-Hart said in error C2666: 'snex::hmath::pow': ove rloaded functions have similar conversions:
The yellow light also indicates that there is a compiler warning and if you click on the debug symbol
I hadn't noticed this before. Very handy!