Skip to content
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

[Question] nesting prefixes #43

Closed
triallax opened this issue Jun 15, 2021 · 4 comments · Fixed by #47
Closed

[Question] nesting prefixes #43

triallax opened this issue Jun 15, 2021 · 4 comments · Fixed by #47

Comments

@triallax
Copy link
Contributor

From the types of "prefix" functions (e.g. mega) it seems like I can "nest" prefixes like so: kilo (mega gram). Is this intended, and if not, are there any safeguards against that?

@sharkdp
Copy link
Owner

sharkdp commented Jun 15, 2021

Thank you for reporting this.

I think you are right. Nesting itself wouldn't be too bad (IMO), but I think the result would be that of the outer prefix instead of a proper composition/multiplication of the prefixes. Example:

  • I think it would be okay if kilo (mega gram) == giga gram. Similar constructions come up if you have something like 1 kW / g * 1 kg = 1 "kilo kilo" W = 1 MW
  • I would say that we should fix something if currently kilo (mega gram) == kilo gram.
  • Completely preventing kilo (mega gram) would also be okay for me.

What do you think?

@triallax
Copy link
Contributor Author

triallax commented Jun 15, 2021

I definitely agree that if 2 is the case, it should be fixed. I also think that either 1 or 3 are fine, but I'm leaning towards disallowing it completely since I think it's very unlikely that one would be writing that on purpose and that it's likely to be a mistake (I welcome any invalidating examples). Of course, the expression you provided should still be possible to resolve to 1 MW, but one could also argue that 1000 kW is more "correct" in that it keeps the original prefix. That's a discussion for another day though, and if I'm not wrong this issue has no bearing on if it resolves to 1 MW or 1000 kW.

@sharkdp
Copy link
Owner

sharkdp commented Jul 6, 2021

I just checked that (kilo (mega gram)) == (giga gram). I will add a test for that shortly. I think we could then close this ticket?

@triallax
Copy link
Contributor Author

triallax commented Jul 6, 2021

Yes, that sounds good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants