On Fri, 23 Jun 2006 02:17:39 -0700, Filip Wasilewski wrote: > [EMAIL PROTECTED] wrote: > >> Logically, I should be able to enter x[-2:-0] to get the last and next to >> last characters. However, since Python doesn't distinguish between positive >> and negative zero, this doesn't work. Instead, I have to enter x[-2:]. > > Hooray! Logically there is no such thing as positive or negative zero, > or did I miss something in the primary?
No, not in the primary, or even in the secondary, but possibly in the tertiary. For many purposes, it doesn't make sense to distinguish +0 from -0. But for other purposes, it does. For instance, in floating point maths, it may be useful for negative numbers that underflow to be distinguished from positive numbers that underflow. See, for example, http://www.savrola.com/resources/negative_zero.html In statistical mechanics, some systems can have negative absolute temperatures, including negative zero. Counter-intuitively, negative absolute temperatures aren't colder than absolute zero, but hotter than any positive temperature. So, strangely enough, a temperature of -0K is hotter than a infinitely hot temperature! (Those wacky physicists and their mathematics...) See http://en.wikipedia.org/wiki/Negative_absolute_temperature for a description. And in case you think this is just a modern version of angels dancing on the head of a pin, negative absolute temperatures are essential for lasers. In pure mathematics, zero is usually considered unsigned. However, in "non-standard analysis" using so-called "hyperreal" or "surreal" numbers, mathematicians use infinitesimals which are [sloppy hand-waving] like signed zeroes. To put it another way, only slightly less sloppy, infinitesimals are zero, but not all the same zero. When doing calculus with complex numbers, it is very important to distinguish which direction you are taking your limits in, and so lim z -> 0+0i is not necessarily the same as lim z -> 0-0i. -- Steven -- http://mail.python.org/mailman/listinfo/python-list