[issue39059] Getting incorrect results in rounding procedures

2019-12-17 Thread Mark Dickinson
Change by Mark Dickinson : -- nosy: -mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39059] Getting incorrect results in rounding procedures

2019-12-17 Thread AVicennA
AVicennA added the comment: @mark.dickinson: You asked some questions, then, I also asked you about solving this problem. It seems to me you just love to talk.. I just answered to your questions. If "this isn't the right forum for that discussion" as you mean, it concerns you too. When you

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread Kubilay Kocak
Change by Kubilay Kocak : -- nosy: -koobs ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread Mark Dickinson
Mark Dickinson added the comment: @AVicennA: 4.39 *is* the correctly-rounded result for `round(4.395, 2)`. Modulo (as-yet unreported) bugs, `round` does correct-rounding (in the IEEE 754 sense) in all cases. I was pointing out that your `my_round` does not solve the problem you think it

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread Steve Dower
Change by Steve Dower : -- nosy: -steve.dower ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread AVicennA
AVicennA added the comment: @mark.dickinson, 1) Where is your "`round` is giving the correct result in all cases"?? >>> round(4.395, 2) 4.39 2) I wrote it in my post using decimal punct: ''' Because, when the decimal string is converted to a binary floating-point number, it's again

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread Terry J. Reedy
Terry J. Reedy added the comment: The flaw in my_round is that it rounds twice, not once. The first rounding is caused by multiplying by a factor that is not a power of 2. In the case of 2.675, that rounding is up enough to affect the second rounding. >>> format(2.675, ".17f")

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread AVicennA
AVicennA added the comment: @steven.daprano, yes, my_round(2.675, 2) --> gave 2.68 and it's not buggy and not wrong. This is correct in this case. I advise you look at 5th class math book. -- ___ Python tracker

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread Mark Dickinson
Change by Mark Dickinson : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread Mark Dickinson
Mark Dickinson added the comment: @AVicennA: as the docs you linked to explain, this is not a bug: `round` is giving the correct result in all cases (or at least, as correct as is possible given the use of binary floating-point). Let's take just the first case, `round(2.675, 2)`. `2.675` is

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: You've spent a lot of time demonstrating behaviour, but have not given us any reason why you think the results given are wrong. As far as I can tell, every single example you show is correct. You have even quoted one of the relevant sections from the docs.

[issue39059] Getting incorrect results in rounding procedures

2019-12-16 Thread AVicennA
New submission from AVicennA : This is about rounding process and getting incorrect results. In documentation written that, "This is not a bug: it’s a result of the fact that most decimal fractions can’t be represented exactly as a float". -