Skip to content

Automatic cancelation of derived units #2658

Answered by ericman314
dkirkby asked this question in Q&A
Discussion options

You must be logged in to vote

I'm not sure. If anything, I would think it should return W since that is even simpler than J / s. It doesn't really "know" that it should cancel the m's, it just looks at the entire unit to see if there is a single unit (like W) that fits.

Units are not actually simplified until they are formatted for output; this does improve the performance if you have lots of calculations in a row, and output one answer at the end. But this also means toString has side effects--ouch!

Because of these problems, I've been working on a complete overhaul of the units for a while now, and when that is ready it should address issues like this.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by josdejong
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants
Converted from issue

This discussion was converted from issue #1972 on August 17, 2022 08:49.