Hysteresivity: Difference between revisions

From formulasearchengine
Jump to navigation Jump to search
en>Magioladitis
m Remove space in percent per WP:PERCENT + general fixes using AWB (8455)
No edit summary
 
Line 1: Line 1:
'''Signed zero''' is [[zero]] with an associated [[Plus and minus signs|sign]]. In ordinary arithmetic, the number 0 does not have a sign, so that −0, +0 and 0 are identical. However, in  [[computing]], some number representations allow for the existence of two zeros, often denoted by '''−0''' ('''negative zero''') and '''+0''' ('''positive zero'''), regarded as equal by the numerical comparison operations but with possible different behaviors in particular operations. This occurs in the ''sign and magnitude'' and ''ones' complement'' [[signed number representation]]s for integers, and in most [[floating-point number]] representations. The number 0 is usually encoded as +0, but can be represented by either +0 or −0.
The writer's title is Andera and she thinks it seems quite great. As a lady what she truly likes is style and she's been performing it for fairly a while. Distributing manufacturing has been his profession for some time. Ohio is where my home is but my husband desires us to transfer.<br><br>Feel free to visit my blog post :: [http://help.ksu.Edu.sa/node/65129 online psychic readings]
 
The [[IEEE 754]] standard for floating-point arithmetic (presently used by most computers and programming languages that support floating point numbers) requires both +0 and −0. Real arithmetic with signed zeros can be considered as a variant of the [[extended real number line]] such that 1/−0 = −[[infinity|∞]] and 1/+0 = +∞; [[Division (mathematics)|division]] is only [[Indeterminate form|undefined]] for [[Plus-minus sign|±]]0/±0 and ±∞/±∞.
 
Negatively signed zero echoes the [[mathematical analysis]] concept of approaching 0 from below as a [[one-sided limit]], which may be denoted by ''x''&nbsp;→&nbsp;0<sup>−</sup>, ''x''&nbsp;→&nbsp;0−, or ''x''&nbsp;→&nbsp;↑0.  The notation "−0" may be used informally to denote a small negative number that has been [[rounding|rounded]] to zero.  The concept of negative zero also has some theoretical applications in [[statistical mechanics]] and other disciplines.
 
It is claimed that the inclusion of signed zero in IEEE 754 makes it much easier to achieve numerical accuracy in some critical problems,<ref>[[William Kahan]], "Branch Cuts for Complex Elementary Functions, or Much Ado About Nothing's Sign Bit", in [http://portal.acm.org/citation.cfm?id=59678 ''The State of the Art in Numerical Analysis''] (eds. Iserles and Powell), Clarendon Press, Oxford, 1987.</ref> in particular when computing with [[complex numbers|complex]] elementary functions.<ref>[[William Kahan]], [http://www.cs.berkeley.edu/~wkahan/Math185/Derivative.pdf Derivatives in the Complex z-plane], p 10.</ref> On the other hand, the concept of signed zero runs contrary to the general assumption made in most mathematical fields (and in most mathematics courses) that negative zero is the same thing as zero.  Representations that allow negative zero can be a source of errors in programs, as software developers do not realize (or may forget) that, while the two zero representations behave as equal under numeric comparisons, they yield different results in some operations.
 
==Representations==
The widely used [[two's complement]] encoding does not allow a negative zero.  In a 1+7-bit [[signed magnitude|sign-and-magnitude]] representation for integers, negative zero is represented by the bit string 1000 0000. In an 8-bit [[one's complement]] representation, negative zero is represented by the bit string 1111 1111. In all three encodings, positive zero is represented by {{gaps|0000|0000}}.
 
[[Image:IEEE 754 Single Negative Zero.svg|thumb|right|400px|Negative zero by IEEE 754 representation in [[binary32]]]]
In [[IEEE floating-point standard|IEEE 754]] binary floating point numbers, zero values are represented by the biased exponent and [[significand]] both being zero. Negative zero has the sign bit set to one.  One may obtain negative zero as the result of certain computations, for instance as the result of [[arithmetic underflow]] on a negative number, or <code>−1.0*0.0</code>, or simply as <code>−0.0</code>.
 
In [[IEEE 754-2008|IEEE 754]] decimal floating point encoding, a negative zero is represented by an exponent being any valid exponent in the range for the encoding, the true significand being zero, and the sign bit being one.
 
==Properties and handling==
The IEEE 754 floating point standard specifies the behavior of positive zero and negative zero under various operations.  The outcome may depend on the current [[floating point#Rounding modes|IEEE rounding mode]] settings.
 
===Arithmetic===
Multiplication and division follow their usual rules for combining signs:
* <math>\frac{-0}{ \left| x \right| } = -0\,\!</math> (for <math>x</math> different from 0)
 
* <math>(-0) \cdot (-0) = +0\,\!</math>
 
Addition and subtraction are handled specially if the values could cancel:
 
* <math>x + (\pm 0) = x\,\!</math> (for <math>x</math> different from 0)
 
* <math>(-0) + (-0) = (-0) - (+0) = -0\,\!</math>
 
* <math>(+0) + (+0) = (+0) - (-0) = +0\,\!</math>
 
* <math>x - x = x + (-x) = +0\,\!</math> (for any finite <math>x</math>, −0 when rounding toward negative)
 
Because of negative zero (and only because of it), the statements {{nowrap|''z'' {{=}} −(''x'' − ''y'')}} and {{nowrap|''z'' {{=}} (−''x'') − (−''y'')}}, for floating-point variables ''x'', ''y'', and ''z'', cannot be optimized to {{nowrap|''z'' {{=}} ''y'' − ''x''}}.
 
Some other special rules:
* <math>\sqrt{-0} = -0\,\!</math> <ref>{{cite web|url=http://speleotrove.com/decimal/daops.html#refsqrt|title=Decimal Arithmetic: Arithmetic operations &ndash; square-root|first=Mike|last=Cowlishaw|authorlink=Mike Cowlishaw|date=7 April 2009|publisher=speleotrove.com ([[IBM Corporation]])|accessdate=7 December 2010}}</ref>
 
* <math>\frac{-0}{-\infty} = +0\,\!</math>  (follows the sign rule for division)
 
* <math>\frac{\left|x\right|}{-0} = -\infty\,\!</math>  (for non-zero <math>x</math>, follows the sign rule for division)
 
* <math>{\pm 0} \times {\pm \infty} = \mbox{NaN}\,\!</math> ([[Not a Number]] or interrupt for [[indeterminate form]])
 
* <math>\frac{\pm 0}{\pm 0} = \mbox{NaN}\,\!</math>
 
Division of a non-zero number by zero sets the divide by zero [[flag (computing)|flag]], and an operation producing a NaN sets the invalid operation flag. An [[exception handling|exception handler]] is called if enabled for the corresponding flag.
 
===Comparisons===
According to the IEEE 754 standard, negative zero and positive zero should compare as equal with the usual (numerical) comparison operators, like the <code>==</code> operators of [[C (programming language)|C]] and [[Java programming language|Java]].  In those languages, special programming tricks may be needed to distinguish the two values:
*[[Type punning]] the number to an integer type, so as to look at the sign bit in the bit pattern;
*using the IEEE 754 <code>copysign()</code> function to copy the sign of the zero to some non-zero number;
*taking the reciprocal of the zero to obtain either 1/(+0)&nbsp;=&nbsp;+∞ or 1/(−0)&nbsp;=&nbsp;−∞ (if the [[division by zero]] exception is not trapped).
Note: [[Cast (computer programming)|Casting]] to integral type will not always work, especially on two's complement systems.
 
However, some programming languages may provide alternative comparison operators that do distinguish the two zeros. This is the case, for example, of the <tt>equals</tt> method in Java's <code>Double</code> class.<ref>[http://java.sun.com/javase/6/docs/api/java/lang/Double.html#equals%28java.lang.Object%29]</ref>
 
==Scientific uses==
Informally, one may use the notation "−0" for a negative value that was rounded to zero.  This notation may be useful when a negative sign is significant; for example, when tabulating [[Celsius]] temperatures, where a negative sign means ''below freezing''.
 
In statistical mechanics, one sometimes uses [[negative temperature]]s to describe systems with [[population inversion]], which can be considered to have a temperature greater than positive infinity, because the coefficient of energy in the population distribution function is &minus;1/Temperature. In this context, a temperature of &minus;0 is a (theoretical) temperature larger than any other negative temperature, corresponding to the (theoretical) maximum conceivable extent of population inversion, the opposite extreme to +0.<ref>{{cite book | author=[[Charles Kittel|Kittel, Charles]] and [[Herbert Kroemer]] | title=Thermal Physics (2nd ed.) | publisher=W. H. Freeman Company | year=1980 | isbn=0-7167-1088-9|page=462}}</ref>
 
==See also==
*[[Line with two origins]]
 
==References==
{{Reflist}}
{{Refbegin}}
* {{cite web|url=http://msdn.microsoft.com/library/en-us/csspec/html/vclrfcsharpspec_4_1_6.asp|title=Floating point types|work=[[Microsoft Developer Network|MSDN]] C# Language Specification|accessdate=15 October 2005}}
* {{cite web|url=http://msdn.microsoft.com/library/en-us/csspec/html/vclrfcsharpspec_7_7_2.asp|title=Division operator|work=[[Microsoft Developer Network|MSDN]] C# Language Specification|accessdate=15 October 2005}}
* {{cite paper|url=http://www.concentric.net/~Ttwang/tech/javafloat.htm|title=Java Floating-Point Number Intricacies|author=Thomas Wang|month=March|year=2000|version=September 2000}}
* {{cite web|url=http://speleotrove.com/decimal/decarith.html|title=Decimal Arithmetic Specification, version 1.68|author=Mike Colishaw|date=28 July 2008|accessdate=2008-08-14}} &mdash; a ''decimal'' floating point specification that includes negative zero
{{Refend}}
 
== Further reading ==
{{refbegin}}
* {{cite web|url=http://developers.sun.com/prodtech/cc/articles/sign.html|title=Fortran 95 SIGN Change|author=Michael Ingrassia|work=Sun Developer Network|accessdate=October 15, 2005}} &mdash; the changes in the [[Fortran]] <code>SIGN</code> function in Fortran 95 to accommodate negative zero
* {{cite web|url=http://msdn.microsoft.com/library/en-us/script56/html/js56jscondatatype.asp|title=JScript data types|work=[[Microsoft Developer Network|MSDN]] JScript|accessdate=October 16, 2005}} &mdash; JScript's floating point type has negative zero by definition
* {{cite web|url=http://www.javaworld.com/javaworld/jw-10-1996/jw-10-hood.html|title=A look at the floating-point support of the Java virtual machine|work=Javaworld|accessdate=October 16, 2005}} &mdash; representation of negative zero in the [[Java virtual machine]]
* {{cite paper|url=http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm|title=Comparing floating point numbers|author=Bruce Dawson|date=}} &mdash; how to handle negative zero when comparing floating-point numbers
* {{cite web|url=http://www.fourmilab.ch/documents/univac/minuszero.html|title=Minus Zero|author=John Walker|work=UNIVAC Memories|accessdate=October 17, 2005|authorlink=John Walker (programmer)}} &mdash; One's complement numbers on the [[UNIVAC]] 1100 family computers.
{{refend}}
 
{{DEFAULTSORT:Signed Zero}}
[[Category:Computer arithmetic]]
[[Category:Integers|-9 (number)]]
[[Category:Zero]]

Latest revision as of 16:47, 7 May 2014

The writer's title is Andera and she thinks it seems quite great. As a lady what she truly likes is style and she's been performing it for fairly a while. Distributing manufacturing has been his profession for some time. Ohio is where my home is but my husband desires us to transfer.

Feel free to visit my blog post :: online psychic readings