[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
STINNER Victor added the comment: Ok, fbound() is now better in all branches. I also fixed all compiler warnings in 2.7. I close the issue. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
STINNER Victor added the comment: New changeset e5b79c546370521764457ea2ec809303e580f5ea by Victor Stinner in branch '2.7': bpo-19418: audioop.c: Fix warnings on -0x8000 (GH-7453) https://github.com/python/cpython/commit/e5b79c546370521764457ea2ec809303e580f5ea --

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
STINNER Victor added the comment: New changeset 2bc1946fb02e140f5f5ac21a1afa2763615ad16b by Victor Stinner (Miss Islington (bot)) in branch '3.6': bpo-33781: audioop: enhance rounding double as int (GH-7447) (GH-7451)

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +7076 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
STINNER Victor added the comment: > New changeset b17d409bc0458e3981987c2358da661f228f5891 by Victor Stinner in > branch '2.7': > bpo-33781: audioop: enhance rounding double as int (GH-7447) (GH-7452) I checked AppVeyor logs: this change fixed the audioop.c warning that I wanted to fix ;-)

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
STINNER Victor added the comment: New changeset b17d409bc0458e3981987c2358da661f228f5891 by Victor Stinner in branch '2.7': bpo-33781: audioop: enhance rounding double as int (GH-7447) (GH-7452) https://github.com/python/cpython/commit/b17d409bc0458e3981987c2358da661f228f5891 --

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
STINNER Victor added the comment: Note: I chose to not add a NEWS entry, because even if my change might enhance the rounding, I don't think that it has any effect in practice :-) -- ___ Python tracker

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +7074 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread miss-islington
miss-islington added the comment: New changeset 5c022f13ab6db8929e092ad035b3dc61701e3198 by Miss Islington (bot) in branch '3.7': bpo-33781: audioop: enhance rounding double as int (GH-7447) https://github.com/python/cpython/commit/5c022f13ab6db8929e092ad035b3dc61701e3198 -- nosy:

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
STINNER Victor added the comment: > But since it is always used with floor(), it is better to move floor() inside > it. Yeah, that's what I did ;-) I will backport the change to 3.7, 3.6 and 2.7. My final goal is just to fix a compiler warning in 2.7 :-D --

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It was my mistake. fbound() should be return double. But since it is always used with floor(), it is better to move floor() inside it. -- nosy: +serhiy.storchaka pull_requests: +7073 ___ Python tracker

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread miss-islington
Change by miss-islington : -- pull_requests: +7072 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
STINNER Victor added the comment: New changeset 45e4efba7fa2abe61d25e4f8b5bf482e19ff1280 by Victor Stinner in branch 'master': bpo-33781: audioop: enhance rounding double as int (GH-7447) https://github.com/python/cpython/commit/45e4efba7fa2abe61d25e4f8b5bf482e19ff1280 --

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
STINNER Victor added the comment: Oh, fbound() cast to (int) has been done by... myself :-D commit f2b9a340ef143099726fb642951410e4ad793c7f Author: Victor Stinner Date: Tue May 7 23:49:15 2013 +0200 audioop: explicit cast to fix a compiler warning diff --git a/Modules/audioop.c

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
Change by STINNER Victor : -- keywords: +patch pull_requests: +7070 stage: -> patch review ___ Python tracker ___ ___

[issue33781] audioop.c: fbound() casts double to int for its return value

2018-06-06 Thread STINNER Victor
New submission from STINNER Victor : Extract of Python 2.7, Modules/audioop.c: static int fbound(double val, double minval, double maxval) { if (val > maxval) val = maxval; else if (val < minval + 1) val = minval; return val; } Example of usage: double factor,