[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-16 Thread Mark Dickinson
Mark Dickinson added the comment: Thanks for the suggestion. I'm closing this as rejected, for the reasons Tim gave. -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker

[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-16 Thread Mark Dickinson
Mark Dickinson added the comment: [Serhiy] > What about math.trunc() and round()? Should they return int or float? math.trunc was deliberately introduced to be an explicitly-value-modifying conversion to int (as opposed to "int" itself, which is used for both lossy and lossless conversions

[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > math.floor(), which does return an int, [...] and I believe it was a mistake > to change it to return an int. What about math.trunc() and round()? Should they return int or float? And what about the result of the floor division of floats? Should it be

[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-16 Thread Mark Dickinson
Mark Dickinson added the comment: [Tim] > I don't think it would be doing anyone a real favor by returning [...] Agreed. > math.floor(), which does return an int, [...] and I believe it was a mistake > to change it to return an int. Also agreed. --

[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Raymond, I think you've tricked yourself ;-) Yup. -- ___ Python tracker ___ ___

[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-15 Thread Tim Peters
Tim Peters added the comment: Raymond, I think you've tricked yourself ;-) The prototype for C's duoble modf is double modf(double x, double *intptr); Yes, after the call *intptr is an exact integer, but in the double format. >>> math.modf(1e300) (0.0, 1e+300) I don't think it would be

[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: This is odd. The underlying C library modf() returns an integer for the second part. Likewise the Python math.frexp() function returns an integer for the second part. So, I'm not sure why Python's math.modf() returns a float for the second field.

[issue38813] math.modf() change integer returned part as integer instead of float

2019-11-15 Thread aikimark1955
New submission from aikimark1955 : The description for this function reads: "Return the fractional and integer parts of x. Both results carry the sign of x and are floats." Since the second returned value is "integer parts", I submit that the value should be integer. -- components: