Replies: 3 comments
-
That would be quite the undertaking. You could change code to use decimal but it would be quite impossible to port changes after the fork. Maybe try to iterate the "for reasons" and whether it's worth it. JavaScript is a bad place to worry about floating point precision. |
Beta Was this translation helpful? Give feedback.
-
Some potentially easier alternatives to changing the implementation of the
All of them requires modification to existing scripts if there's any. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answers, I will try to solve it somehow. The background story is that my system uses Elsa Workflow Engine (https://github.com/elsa-workflows/elsa-core) which uses JavaScript as expression language (and Jint for the interpreter). Workflows are defined and executed using .Net Framework, but users can insert JavaScript expressions to compute something and these expressions can reference workflow variables. So when somebody declares variable mySalary : decimal in workflow - it becomes mySalary : Number (double) in JavaScript expression. And as you know, double is not the best type for money. So I thought I would make my version of Jint which would have decimal instead of double. :-) |
Beta Was this translation helpful? Give feedback.
-
Hello Community!
For some reason, I need a version of Jint that uses decimal underneath for JavaScript numbers instead of double. This would be a private fork just for my needs of course. I've searched the code for the word "double" - and there's quite a bit of it.
In the right places I would have to change to decimal.
Any hint/advice? Any chance this can be easily done?
Beta Was this translation helpful? Give feedback.
All reactions