Repository navigation
Custom units having unexpected effects on results #3748
Replies: 9 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 |
|
As there's not in the end an acknowledged specific bug here, but this has rather turned into a conversation about how units should be selected for display and how the auto unit system should work, and because it's not even clear whether this conversation belongs here or in https://github.com/ericman314/UnitMath, moving this to a discussion. |
Uh oh!
There was an error while loading. Please reload this page.
I'm encountering an issue where custom units are changing how expressions that do not include the new unit are evaluated.
Example:
All reactions