我试图在 NCalc 中运行这个公式:
"( Abs([a] - [b]) / ( ([a] + [b]) / 2.0 ) ) * 100"
我得到错误:
Operator '/' can't be applied to operands of types 'decimal' and 'double'
[a] 和 [b] 参数作为小数传递。我试着把 'm' 放在 2 和 100 上,如下所示:
"( Abs([a] - [b]) / ( ([a] + [b]) / 2m ) ) * 100m"
但它抛出了一个异常:
Additional information: extraneous input 'm' expecting ')' at line 1:36