Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #27715
| Date | 2012-08-23 11:28 +0200 |
|---|---|
| From | Laszlo Nagy <gandalf@shopzeus.com> |
| Subject | Re: Guarding arithmetic |
| References | <8b9a5844-66b0-4940-946a-5e626462cdce@googlegroups.com> <CAPTjJmrcfXrbaDsdKiN=N+mRz_y1FVz5MPBAGfqVHd5Hn+thUw@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3703.1345714142.4697.python-list@python.org> (permalink) |
> That can work ONLY if the division of 1/0 doesn't raise an exception. > This is why the concept of NaN exists; I'm not sure if there's a way > to tell Python to return NaN instead of bombing, but it's most likely > only possible with floating point, not integer. For integers, Python will always raise an exception when you try to divide by zero. And integers has nothing to do with NaN. Because NaN is meaningful for floating point numbers only. Python can be compiled to raise floating point exceptions. (On Python 2, this is a compile time option: FPECTL. On Python 3, this can be configured runtime: http://docs.python.org/library/fpectl.html )
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Guarding arithmetic Mark Carter <alt.mcarter@gmail.com> - 2012-08-23 02:05 -0700
Re: Guarding arithmetic Chris Angelico <rosuav@gmail.com> - 2012-08-23 19:16 +1000
Re: Guarding arithmetic Mark Carter <alt.mcarter@gmail.com> - 2012-08-23 02:22 -0700
Re: Guarding arithmetic Chris Angelico <rosuav@gmail.com> - 2012-08-23 19:29 +1000
Re: Guarding arithmetic Mark Carter <alt.mcarter@gmail.com> - 2012-08-23 02:22 -0700
Re: Guarding arithmetic Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-23 11:23 +0200
Re: Guarding arithmetic Mark Carter <alt.mcarter@gmail.com> - 2012-08-23 02:47 -0700
Re: Guarding arithmetic Mark Carter <alt.mcarter@gmail.com> - 2012-08-23 02:47 -0700
Re: Guarding arithmetic Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-23 11:28 +0200
Re: Guarding arithmetic Chris Angelico <rosuav@gmail.com> - 2012-08-23 19:30 +1000
Re: Guarding arithmetic Peter Otten <__peter__@web.de> - 2012-08-23 12:11 +0200
Re: Guarding arithmetic rusi <rustompmody@gmail.com> - 2012-08-23 10:15 -0700
Re: Guarding arithmetic Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-23 13:01 +0200
Re: Guarding arithmetic MRAB <python@mrabarnett.plus.com> - 2012-08-23 12:21 +0100
Re: Guarding arithmetic Peter Otten <__peter__@web.de> - 2012-08-23 13:28 +0200
Re: Guarding arithmetic Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-23 15:11 +0100
Re: Guarding arithmetic Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-23 14:49 -0400
Re: Guarding arithmetic Chris Angelico <rosuav@gmail.com> - 2012-08-24 07:48 +1000
csiph-web