[EMAIL PROTECTED] schrieb: > If C90 doesn't distinguish -0.0 and +0.0, how can Python? Can you give a > simple example where the difference between the two is apparent to the > Python programmer?
Sure: py> x=-0.0 py> y=0.0 py> x,y (-0.0, 0.0) py> hash(x),hash(y) (0, 0) py> x==y True py> str(x)==str(y) False py> str(x),str(y) ('-0.0', '0.0') py> float(str(x)),float(str(y)) (-0.0, 0.0) Imagine an application that reads floats from a text file, manipulates some of them, and then writes back the complete list of floats. Further assume that somehow, -0.0 got into the file. Currently, the sign "round-trips"; under the proposed change, it would stop doing so. Of course, there likely wouldn't be any "real" change to value, as the sign of 0 is likely of no significance to the application. Regards, Martin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com