Hello MariaEsmeral,
I fit is necessary for you to have a rounding with a dynamic number of digits then my suggestion is to add a NoValue function to your script. As you mentioned in case of zero the ChnCalculate function returnes for the log a NoValue. But in case of zero a rounding would return zero. So after the calculation with ChnCalculate you can set all NoValues to zero with this command:
Call ChnNovHandle("[1]/Channel1","[1]/Channel1","SetValue","XY",1,1,0)
You find the NoValue handling function in ANALYSIS in the toolbar “Channel functions”
Greetings
Walter