<div dir="ltr">On Wed, Mar 21, 2018 at 11:43 PM, Tim Peters <span dir="ltr"><<a href="mailto:tim.peters@gmail.com" target="_blank">tim.peters@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Note:  this is a top-posted essay much more about floating-point<br>
philosophy than about details.  Details follow from the philosophy,<br>
and if philosophies don't match the desired details will never match<br>
either.<br></blockquote><div><br></div><div>but of course :-)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
>From that fundamental "take floats exactly at face value" view, what<br>
.is_integer() should do for floats is utterly obvious: </blockquote><div><br></div><div>sure -- but I don't think anyone is arguing that -- the question is whether the function should exist -- and that means not "how should it work?" or "is it clearly and appropriately defined?" but rather, "is it the "right" thing to do in most cases, when deployed by folks that haven't thought deeply about floating point.<br><br></div>> Whether that's _useful_ to you depends on the application you're<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
writing at the time.</blockquote><div><br></div><div>exactly.<br><br></div>I think pretty much all the real world code that's been shown here for using .is_integer() is really about type errors (issues). The function at hand really wants integer inputs -- but wants to allow the user to be sloppy and provide a float type that happens to be an int. Given Python's duck-typing nature, maybe that's a good thing? I know I really discourage dynamic type checking....<br><br></div><div class="gmail_quote">Also, every example has been for small-ish integers -- exponents, factorials, etc -- not order 1e300 -- or inf or NaN, etc.<br><br></div><div class="gmail_quote">Finally, the use-cases where the value that happens-to-be-an-int is computed via floating point -- .is_integer() is probably the wrong check -- you probably want  isclose().<br><br>The other use-cases: and floor() and ceil() and round() all produce actual integers -- so no need for that anymore.<br></div><div class="gmail_quote"><div><br></div><div>All this points to: we don't need .is_integer<br></div><div><br></div><div>All the being said -- the standard for depreciation is much higher bar than not-adding-it-in-the-first-place.<br></div><br><div class="HOEnZb"><div class="h5">-CHB<br><br>
</div></div></div><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>