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

add a function for min_max_mantissa #639

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

Conversation

ShayanEmzed
Copy link

Fixes #609

I just create a function in formatting.js file.
You must pass three inputs:

  • num: desired number
  • min: minimum number of decimal
  • max: maximum number of decimal

And then you will get your output.

For example:

let num = 12.345678
console.log(correct_float_format(num, 2, 4));

output will be: 12.3456

  • To fix this issue i just used a trick and converted the number to string and then used .split function to get the number of decimal.

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.

Minimum and maximum length for mantissa
1 participant