Skip to content

Commit

Permalink
👾 [BUG]: Fixed an issue where precision was lost when numbers were pa…
Browse files Browse the repository at this point in the history
…ssed between JS and C#. See https://gitee.com/dotnetchina/NanUI/issues/I9BT34
  • Loading branch information
XuanchenLin committed May 1, 2024
1 parent 8d61d28 commit 0a7149a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,12 @@ public double GetDouble()
{
if (ValueType == JavaScriptValueType.Number)
{
var value = Math.Ceiling((double?)RawValue ?? 0);
if(RawValue is double || RawValue is float || RawValue is decimal)
{
return (double)Convert.ChangeType(RawValue, TypeCode.Double);
}

return (double)Convert.ChangeType(value, TypeCode.Double);
return (double)(Convert.ChangeType(RawValue, TypeCode.Int32));
}

if (ValueType == JavaScriptValueType.Bool)
Expand Down

0 comments on commit 0a7149a

Please sign in to comment.