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

Added conversion to millions, billions, etc #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added conversion to millions, billions, etc #6

wants to merge 1 commit into from

Conversation

sandro-pasquali
Copy link

No description provided.

@taijinlee
Copy link
Owner

Thanks for the pull request. Unfortunately, I don't really understand the code when I skim it, and for a function of this nature, I personally think it should be obvious instead of convoluted. I briefly looked at the gist, and it seems like the massive regex is inserting commas every 3 digits (I'm not even completely sure about that). That seems like a very roundabout way of doing what is desired.

The way I would structure this code instead would be: loop on (if n < 1000, n/1000) and count the number of times this happens to determine what the string part should be, maybe with an upper limit since our max is trillion. Instead of rounding automatically, I would prefer to see a flag that specifies the number of significant digits, defaulting to 3 (since we're dividing by 1000). Finally, I would appreciate it if you also added unit tests for this, as the entire system has been setup at great lengths.

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 this pull request may close these issues.

2 participants