You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: