-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom units having unexpected effects on results #1306
Comments
That's a result of having the unit system set to the default of You can disable that using |
Thanks @ericman314 , is that a function on the math object, or the unit itself? I can't find any mention of it on mathjs.org. |
I think you can use this: math.type.Unit.setUnitSystem('si'); |
If I set the unit system only once after creating the math object, it doesn't work (I need to set it after creating the unit). So this works:
However, for my purposes the user will be able to add custom units at any time. Of course, I can just set the unit system again after any new unit is created, however it seems there is a bug: if I set unit system twice, it stops applying:
|
Also, setting the unit system to 'si' undoes the fix you made the other day for the 'incorrect custom unit in unit multiplication result' issue:
Maybe |
As for As for It's hard to infer what the user wants to see. For instance, what should the result of |
I definitely want the intelligent unit choosing behaviour, so I'll have to stick with Could we then consider Personally I don't think it's a great design move to have the existence of custom units override the standard calculation behaviour. I might not be able to offer users the ability to add custom units at all, if as a result answers of unrelated calculations become unpredictably affected. Furthermore, the (bug? feature?) seems to be only present for compound units:
Would you agree that it makes more sense to explicitly request formatting in custom units?
|
Thinking aloud: sounds like we want to somehow be able to give specific units some sort of precedence, i.e. give a custom unit like |
I'm encountering an issue where custom units are changing how expressions that do not include the new unit are evaluated.
Example:
The text was updated successfully, but these errors were encountered: