-
-
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
Unexpected joules in watt hour calculations #1481
Comments
The way math.js chooses a display unit when using the console.log(math.eval('1 kilowatt * 1 hour').toString())
console.log(math.eval('1 kWh').toString())
console.log(math.eval('1 kilowatt * 1 hour').toString()) Which outputs:
Before you use the We don't like side effects but we haven't been able to come up with a better way to do it yet. |
Thanks Eric, that's indeed quite surprising. Can I ask what the reasoning was behind the decision to take previous calculations into account when evaluating an expression? What would be the downside to math.js only doing a unit conversion in |
We've had lots of issues regarding making the unit formatting more configurable. I've opened another issue so we can collect all the ideas in one place: #1483 |
I'm having trouble understanding math.js's behaviour in regard to watt hour units. I'd expect to be able to work directly with kilowatt hours or watt hours, however they sometimes are displayed in joules implicitly:
Example:
The text was updated successfully, but these errors were encountered: