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

Implement Math.Max and Math.Min functions for BigNumber #167

Open
OrlandoP97 opened this issue May 30, 2024 · 0 comments
Open

Implement Math.Max and Math.Min functions for BigNumber #167

OrlandoP97 opened this issue May 30, 2024 · 0 comments

Comments

@OrlandoP97
Copy link

Hello,

I am currently working on a project where I need to calculate the maximum and minimum values from an array of BigNumber objects. I noticed that there are no functions in the library to handle this for BigNumber objects (or maybe I couldn't found it), similar to Math.max and Math.min for numbers.

The current workaround is to convert the BigNumber objects to numbers and then use Math.max or Math.min. However, this approach has a significant drawback. When two similar but slightly different BigNumber objects are converted to numbers, they could be converted to the same number due to the loss of precision. This results in an inaccurate selection of the minimum and maximum values.

I suggest implementing two new functions, max and min, that can handle arrays of BigNumber objects. These functions would maintain the precision of the BigNumber objects and provide accurate results.

Thank you for considering this suggestion. I believe these functions would be a valuable addition to the BigNumber class and would benefit many developers working with large numbers.

Best regards, Orlando

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

No branches or pull requests

1 participant