Fix NCalc type error when evaluating AI-generated formulas
NCalc2 operates on double internally; passing decimal parameters caused 'Operator * cannot be applied to double and decimal' at runtime. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -181,7 +181,7 @@ Rules:
|
|||||||
foreach (var kv in variables)
|
foreach (var kv in variables)
|
||||||
{
|
{
|
||||||
expr.Parameters[kv.Key] = kv.Value.ValueKind == JsonValueKind.Number
|
expr.Parameters[kv.Key] = kv.Value.ValueKind == JsonValueKind.Number
|
||||||
? (object)kv.Value.GetDecimal()
|
? (object)kv.Value.GetDouble()
|
||||||
: (object)(kv.Value.GetString() ?? "");
|
: (object)(kv.Value.GetString() ?? "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user