marco_ocram <m.balzare...@eureka-market.com> added the comment:
i want to be more clear, these could be useful. https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/round-function This VBA function returns something commonly referred to as bankers rounding. So be careful before using this function. For more predictable results, use Worksheet Round functions in Excel VBA. https://docs.microsoft.com/en-us/dotnet/api/system.math.round?view=netcore-3.1 Rounding to nearest, or banker's rounding Midpoint values are rounded to the nearest even number. For example, both 3.75 and 3.85 round to 3.8, and both -3.75 and -3.85 round to -3.8. This form of rounding is represented by the MidpointRounding.ToEven enumeration member. Rounding to nearest is the standard form of rounding used in financial and statistical operations. It conforms to IEEE Standard 754, section 4. When used in multiple rounding operations, it reduces the rounding error that is caused by consistently rounding midpoint values in a single direction. In some cases, this rounding error can be significant. this is how work the current round() function, but if i don't need to do successive rounding but only adjust data i prefer... https://docs.microsoft.com/en-us/dotnet/api/system.math.round?view=netcore-3.1 Rounding away from zero Midpoint values are rounded to the next number away from zero. For example, 3.75 rounds to 3.8, 3.85 rounds to 3.9, -3.75 rounds to -3.8, and -3.85 rounds to -3.9. This form of rounding is represented by the MidpointRounding.AwayFromZero enumeration member. Rounding away from zero is the most widely known form of rounding. i can understand in decimal the default is banking or accounting rounding and i can adjust the context, but in normal calculations i think will be more usefule the common rounding, or also the possibility to choose with an argument. i have simply implemented my functions, this is only for the sake of improving the language. cheers. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41598> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com