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

fix for number in thousands to go to the proper decimal. #44

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

Conversation

crunksensei
Copy link

@crunksensei crunksensei commented Dec 12, 2024

on line 760 the number 3 should be options.thousand_decimals in order to properly change the options to set the decimal place. otherwise it will always be the 3 decimals that is currently on line 760

example the way it is numbers in the thousands will always show 152.123k 3 decimal places.
the fix changes the amount of decimal places according to the option. so if you have 1 then the example above will be 152.1k

@Warionator
Copy link

Tested this, seems to work for 3 and below, but needing 4 or more decimal places, it seems to cap at 3.

Example, I set Big.setThousandDecimals(5) and received 1.000k instead of the expected 1.00000k

@Warionator
Copy link

I was able to fix this by altering your line of code, check below:

return split[0] + options.decimal_separator + split[1].substr(0, min(options.thousand_decimals, options.dynamic_numbers - split[0].length() if options.dynamic_decimals else options.thousand_decimals))

@crunksensei
Copy link
Author

thanks if you wanted a smaller number or see the decimal places this would be a great fix but I would recommend only using 3 decimals max because anything smaller should not go into the thousands. for example 1.5243k might be a little confusing. its better to show the entire number 1524.3 to remove any confusion. Thanks

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