[Python-bugs-list] bug in complex_nonzero (PR#347)

Tim Peters tim_one@email.msn.com
Mon, 5 Jun 2000 13:54:04 -0400


Frédéric, you should upgrade to Python 1.5.2!  This was fixed a long time
ago (1.5.2 was released more than a year ago).

> -----Original Message-----
> From: python-bugs-list-admin@python.org
> [mailto:python-bugs-list-admin@python.org]On Behalf Of fvdp@decis.be
> Sent: Monday, June 05, 2000 1:13 PM
> To: python-bugs-list@python.org
> Cc: bugs-py@python.org
> Subject: [Python-bugs-list] bug in complex_nonzero (PR#347)
>
>
> Full_Name: Frédéric van der Plancke
> Version: 1.5.1
> OS: Windows NT 4
> Submission from: i0913.bfp-s.euronet.be (212.65.51.151)
>
>
> There is a bug in the test for non-nullity of a complex number.
> e.g. not (1j), not (4+0j) both return 1.
> (they should return 0, like (not n) for any non-null number n.)
>
> correction in <complexobject.c>:
> '||' instead of '&&' in complex_nonzero(v):
>
> static int
> complex_nonzero(v)
> 	PyComplexObject *v;
> {
> 	return v->cval.real != 0.0 || v->cval.imag != 0.0;
> }
>
> (Warning: I did not test my correction ;-)
>
> LEGALESE:
> I confirm that, to the best of my knowledge and belief, this
> contribution is free of any claims of third parties under
> copyright, patent or other rights or interests ("claims").  To
> the extent that I have any such claims, I hereby grant to CNRI a
> nonexclusive, irrevocable, royalty-free, worldwide license to
> reproduce, distribute, perform and/or display publicly, prepare
> derivative versions, and otherwise use this contribution as part
> of the Python software and its related documentation, or any
> derivative versions thereof, at no cost to CNRI or its licensed
> users, and to authorize others to do so.
>
> I acknowledge that CNRI may, at its sole discretion, decide
> whether or not to incorporate this contribution in the Python
> software and its related documentation.  I further grant CNRI
> permission to use my name and other identifying information
> provided to CNRI by me for use in connection with the Python
> software and its related documentation.
>
>
>
> _______________________________________________
> Python-bugs-list maillist  -  Python-bugs-list@python.org
> http://www.python.org/mailman/listinfo/python-bugs-list