# Signed zero

Signed zero is zero with an associated 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 representations 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 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 a variant of the extended real number line such that 1/−0 = − and 1/+0 = +∞; division is only undefined for ±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 → 0, x → 0−, or x → ↑0. The notation "−0" may be used informally to denote a small negative number that has been 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,[1] in particular when computing with complex elementary functions.[2] On the other hand, the concept of signed zero runs contrary to the general assumption made in most mathematical fields that negative zero is the same thing as zero. Representations that allow negative zero can be a source of errors in programs, if software developers do not take into account 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 sign-and-magnitude representation for integers, negative zero is represented by the bit string 10000000. In an 8-bit one's complement representation, negative zero is represented by the bit string 11111111. In all three encodings, positive zero is represented by 00000000.

Negative zero by IEEE 754 representation in binary32

In 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 −1.0×0.0, or simply as −0.0.

In 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 IEEE rounding mode settings.

### Notation

In systems that include both signed and unsigned zeros, the notation ${\displaystyle 0^{+}}$ and ${\displaystyle 0^{-}}$ is sometimes used for signed zeros.

### Arithmetic

Addition and multiplication are commutative, but there are some special rules that have to be followed, which mean the usual mathematical rules for algebraic simplification may not apply. The ${\displaystyle =}$ sign below shows the signed result of the operations.

The usual rule for signs is always followed when multiplying or dividing:

• ${\displaystyle {\frac {-0}{\left|x\right|}}=-0\,\!}$ (for ${\displaystyle x}$ different from 0)
• ${\displaystyle (-0)\cdot (-0)=+0\,\!}$

There are special rules for adding or subtracting signed zero:

• ${\displaystyle x+(\pm 0)=x\,\!}$ (for ${\displaystyle x}$ different from 0)
• ${\displaystyle (-0)+(-0)=(-0)-(+0)=-0\,\!}$
• ${\displaystyle (+0)+(+0)=(+0)-(-0)=+0\,\!}$
• ${\displaystyle x-x=x+(-x)=+0\,\!}$ (for any finite ${\displaystyle x}$, −0 when rounding toward negative)

Because of negative zero (and also when the rounding mode is upward or downward), the expressions −(xy) and (−x) − (−y), for floating-point variables x and y, cannot be replaced by yx. However (−0) + x can be replaced by x with rounding to nearest (except when x can be a signaling NaN).

Some other special rules:

• ${\displaystyle {\sqrt {-0}}=-0\,\!}$[3]
• ${\displaystyle {\frac {-0}{-\infty }}=+0\,\!}$ (follows the sign rule for division)
• ${\displaystyle {\frac {\left|x\right|}{-0}}=-\infty \,\!}$ (for non-zero ${\displaystyle x}$, follows the sign rule for division)
• ${\displaystyle {\pm 0}\times {\pm \infty }={\mbox{NaN}}\,\!}$ (Not a Number or interrupt for indeterminate form)
• ${\displaystyle {\frac {\pm 0}{\pm 0}}={\mbox{NaN}}\,\!}$

Division of a non-zero number by zero sets the divide by zero flag, and an operation producing a NaN sets the invalid operation flag. An 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 == operators of C and 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 ISO C copysign() function (IEEE 754 copySign operation) to copy the sign of the zero to some non-zero number;
• using the ISO C signbit() macro (IEEE 754 isSignMinus operation) that returns whether the sign bit of a number is set;
• taking the reciprocal of the zero to obtain either 1/(+0) = +∞ or 1/(−0) = −∞ (if the division by zero exception is not trapped).

Note: 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 equals method in Java's Double wrapper class.[4]

## 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 temperatures 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 −1/Temperature. In this context, a temperature of −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.[5]

## References

1. ^ William Kahan, "Branch Cuts for Complex Elementary Functions, or Much Ado About Nothing's Sign Bit", in The State of the Art in Numerical Analysis (eds. Iserles and Powell), Clarendon Press, Oxford, 1987.
2. ^
3. ^ Cowlishaw, Mike (7 April 2009). "Decimal Arithmetic: Arithmetic operations – square-root". speleotrove.com (IBM Corporation). Retrieved 7 December 2010.
4. ^ http://java.sun.com/javase/6/docs/api/java/lang/Double.html#equals(java.lang.Object)
5. ^ Kittel, Charles and Herbert Kroemer (1980). Thermal Physics (2nd ed.). W. H. Freeman Company. p. 462. ISBN 0-7167-1088-9.

0

0 (zero) is both a number and the numerical digit used to represent that number in numerals. The number 0 fulfills a central role in mathematics as the additive identity of the integers, real numbers, and many other algebraic structures. As a digit, 0 is used as a placeholder in place value systems. Names for the number 0 in English include zero, nought (UK), naught (US) (), nil, or—in contexts where at least one adjacent digit distinguishes it from the letter "O"—oh or o (). Informal or slang terms for zero include zilch and zip.Ought and aught (), as well as cipher, have also been used historically.

Atan2

The function ${\displaystyle \operatorname {atan2} (y,x)}$ or ${\displaystyle \operatorname {arctan2} (y,x)}$ (from "2-argument arctangent") is defined as the angle in the Euclidean plane, given in radians, between the positive x-axis and the ray to the point (x,y) ≠ (0,0).

The function ${\displaystyle \operatorname {atan2} (y,x)}$ first appeared in the programming language FORTRAN (in IBM's implementation FORTRAN-IV in 1961) and is defined like this. It was originally intended to return a correct and unambiguous value for the angle θ in converting from cartesian coordinates (x,y) to polar coordinates (r,θ).

Equivalently, ${\displaystyle \operatorname {atan2} (y,x)}$ is the argument (also called phase or angle) of the complex number ${\displaystyle x+iy.}$

${\displaystyle \operatorname {atan2} (y,x)}$ returns a single value θ such that π < θπ and, for some r > 0,

{\displaystyle {\begin{aligned}x&=r\cos \theta \\y&=r\sin \theta .\end{aligned}}}

It is clear that ${\displaystyle r={\sqrt {x^{2}+y^{2}}}}$ always, but it is not always accurate to observe

${\displaystyle \theta =\arctan \left({\frac {y}{x}}\right),}$

which is correct only when x > 0. When x < 0, the angle apparent from the expression above is pointing in the opposite direction of the correct angle and a value of π (or 180°) must be either added or subtracted from θ to put the cartesian point (x,y) into the correct quadrant of the Euclidean plane. This requires knowledge of the signs of x and y separately, which is information lost when y is divided by x.

Since any integer multiple of 2π can be added to the angle θ without changing either x or y, implying an ambiguous value for the returned value, the principal value of the angle, in the interval (-π, π] is returned. θ is signed, with counterclockwise angles being positive, and clockwise being negative. Specifically, ${\displaystyle \operatorname {atan2} (y,x)}$ is in the interval [0, π] when y ≥ 0, and in (−π, 0) when y < 0.

Division by zero

In mathematics, division by zero is division where the divisor (denominator) is zero. Such a division can be formally expressed as a/0 where a is the dividend (numerator). In ordinary arithmetic, the expression has no meaning, as there is no number which, when multiplied by 0, gives a (assuming a ≠ 0), and so division by zero is undefined. Since any number multiplied by zero is zero, the expression 0/0 is also undefined; when it is the form of a limit, it is an indeterminate form. Historically, one of the earliest recorded references to the mathematical impossibility of assigning a value to a/0 is contained in George Berkeley's criticism of infinitesimal calculus in 1734 in The Analyst ("ghosts of departed quantities").There are mathematical structures in which a/0 is defined for some a such as in the Riemann sphere and the projectively extended real line; however, such structures cannot satisfy every ordinary rule of arithmetic (the field axioms).

In computing, a program error may result from an attempt to divide by zero. Depending on the programming environment and the type of number (e.g. floating point, integer) being divided by zero, it may generate positive or negative infinity by the IEEE 754 floating point standard, generate an exception, generate an error message, cause the program to terminate, result in a special not-a-number value, a freeze via infinite loop, or a crash.

Double-precision floating-point format

Double-precision floating-point format is a computer number format, usually occupying 64 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.

Floating point is used to represent fractional values, or when a wider range is needed than is provided by fixed point (of the same bit width), even if at the cost of precision. Double precision may be chosen when the range or precision of single precision would be insufficient.

In the IEEE 754-2008 standard, the 64-bit base-2 format is officially referred to as binary64; it was called double in IEEE 754-1985. IEEE 754 specifies additional floating-point formats, including 32-bit base-2 single precision and, more recently, base-10 representations.

One of the first programming languages to provide single- and double-precision floating-point data types was Fortran. Before the widespread adoption of IEEE 754-1985, the representation and properties of floating-point data types depended on the computer manufacturer and computer model, and upon decisions made by programming-language implementers. E.g., GW-BASIC's double-precision data type was the 64-bit MBF floating-point format.

Floating-point arithmetic

In computing, floating-point arithmetic (FP) is arithmetic using formulaic representation of real numbers as an approximation so as to support a trade-off between range and precision. For this reason, floating-point computation is often found in systems which include very small and very large real numbers, which require fast processing times. A number is, in general, represented approximately to a fixed number of significant digits (the significand) and scaled using an exponent in some fixed base; the base for the scaling is normally two, ten, or sixteen. A number that can be represented exactly is of the following form:

${\displaystyle {\text{significand}}\times {\text{base}}^{\text{exponent}},}$

where significand is an integer, base is an integer greater than or equal to two, and exponent is also an integer. For example:

${\displaystyle 1.2345=\underbrace {12345} _{\text{significand}}\times \underbrace {10} _{\text{base}}\!\!\!\!\!\!^{\overbrace {-4} ^{\text{exponent}}}.}$

The term floating point refers to the fact that a number's radix point (decimal point, or, more commonly in computers, binary point) can "float"; that is, it can be placed anywhere relative to the significant digits of the number. This position is indicated as the exponent component, and thus the floating-point representation can be thought of as a kind of scientific notation.

A floating-point system can be used to represent, with a fixed number of digits, numbers of different orders of magnitude: e.g. the distance between galaxies or the diameter of an atomic nucleus can be expressed with the same unit of length. The result of this dynamic range is that the numbers that can be represented are not uniformly spaced; the difference between two consecutive representable numbers grows with the chosen scale.

Over the years, a variety of floating-point representations have been used in computers. In 1985, the IEEE 754 Standard for Floating-Point Arithmetic was established, and since the 1990s, the most commonly encountered representations are those defined by the IEEE.

The speed of floating-point operations, commonly measured in terms of FLOPS, is an important characteristic of a computer system, especially for applications that involve intensive mathematical calculations.

A floating-point unit (FPU, colloquially a math coprocessor) is a part of a computer system specially designed to carry out operations on floating-point numbers.

Jude and Zero

Jude Kinkade and Zero are fictional characters from the VH1 series Hit the Floor, which chronicles the off-the-court drama surrounding a fictional professional basketball team, the Los Angeles Devils. Introduced in the 2014 season two premiere episode "Game Changer", Zero (Adam Senn) is a devious new addition to the Devils from a rival Ohio team, and Jude (Brent Antonello) is the junior agent assigned to him. Jude is also the estranged son of the Devils' unscrupulous owner, Oscar Kinkade (Don Stark). Jude and Zero's working relationship soon evolves into a sexual and then romantic one, which continues for two seasons until the series was cancelled by VH1 in 2016. Hit the Floor was later picked up by BET for a fourth season to air in 2018, with only Antonello returning.

Fans and the press sometimes refer to the duo with the portmanteau "Zude".

Negative number

In mathematics, a negative number is a real number that is less than zero. Negative numbers represent opposites. If positive represents a movement to the right, negative represents a movement to the left. If positive represents above sea level, then negative represents below sea level. If positive represents a deposit, negative represents a withdrawal. They are often used to represent the magnitude of a loss or deficiency. A debt that is owed may be thought of as a negative asset, a decrease in some quantity may be thought of as a negative increase. If a quantity may have either of two opposite senses, then one may choose to distinguish between those senses—perhaps arbitrarily—as positive and negative. In the medical context of fighting a tumor, an expansion could be thought of as a negative shrinkage. Negative numbers are used to describe values on a scale that goes below zero, such as the Celsius and Fahrenheit scales for temperature. The laws of arithmetic for negative numbers ensure that the common sense idea of an opposite is reflected in arithmetic. For example, −(−3) = 3 because the opposite of an opposite is the original value.

Negative numbers are usually written with a minus sign in front. For example, −3 represents a negative quantity with a magnitude of three, and is pronounced "minus three" or "negative three". To help tell the difference between a subtraction operation and a negative number, occasionally the negative sign is placed slightly higher than the minus sign (as a superscript). Conversely, a number that is greater than zero is called positive; zero is usually (but not always) thought of as neither positive nor negative. The positivity of a number may be emphasized by placing a plus sign before it, e.g. +3. In general, the negativity or positivity of a number is referred to as its sign.

Every real number other than zero is either positive or negative. The positive whole numbers are referred to as natural numbers, while the positive and negative whole numbers (together with zero) are referred to as integers.

In bookkeeping, amounts owed are often represented by red numbers, or a number in parentheses, as an alternative notation to represent negative numbers.

Negative numbers appeared for the first time in history in the Nine Chapters on the Mathematical Art, which in its present form dates from the period of the Chinese Han Dynasty (202 BC – AD 220), but may well contain much older material. Liu Hui (c. 3rd century) established rules for adding and subtracting negative numbers. By the 7th century, Indian mathematicians such as Brahmagupta were describing the use of negative numbers. Islamic mathematicians further developed the rules of subtracting and multiplying negative numbers and solved problems with negative coefficients. Western mathematicians accepted the idea of negative numbers around the middle of the 19th century. Prior to the concept of negative numbers, mathematicians such as Diophantus considered negative solutions to problems "false" and equations requiring negative solutions were described as absurd. Some mathematicians like Leibniz (1646-1716) agreed that negative numbers were false, but still used them in calculations.

Sign (mathematics)

In mathematics, the concept of sign originates from the property of every real number being either positive or negative or zero. Depending on local conventions, zero is either considered as being neither a positive, nor a negative number (having no sign, or a specific sign of its own), or as belonging to both, negative and positive numbers (having both signs). If not specifically mentioned this article adheres to the first convention. In some contexts it makes sense to consider a signed zero, e.g., in floating point representations of real numbers within computers. The phrase "change of sign" is associated throughout mathematics and physics to generate the additive inverse (negation, or multiplication by −1) of any object that allows for this construction, and is not restricted to real numbers. It applies among other objects to vectors, matrices, and complex numbers, which are not prescribed to be only either positive, negative, or zero. The word "sign" is also often used to indicate other binary aspects of mathematical objects that resemble positivity and negativity, such as odd and even (sign of a permutation), sense of orientation or rotation (cw/ccw), one sided limits, and others, below.

Sign bit

In computer science, the sign bit is a bit in a signed number representation that indicates the sign of a number. Although only signed numeric data types have a sign bit, it is invariably located in the most significant bit position, so the term may be used interchangeably with "most significant bit" in some contexts.

Almost always, if the sign bit is 0, the number is non-negative (positive or zero). If the sign bit is 1 then the number is negative, although formats other than two's complement integers allow a signed zero: distinct "positive zero" and "negative zero" representations, the latter of which does not correspond to the mathematical concept of a negative number.

In the two's complement representation, the sign bit has the weight −2w−1 where w is the number of bits. In the ones' complement representation, the most negative value is 1 − 2w−1, but there are two representations of zero, one for each value of the sign bit. In a sign-and-magnitude representation of numbers, the value of the sign bit determines whether the numerical value is positive or negative.Floating point numbers, such as IEEE format, IBM format, VAX format, and even the format used by the Zuse Z1 and Z3 use a sign-and-magnitude representation.

When using a complement representation, to convert a signed number to a wider format the additional bits must be filled with copies of the sign bit in order to preserve its numerical value, a process called sign extension or sign propagation.

TSL color space

TSL color space is a perceptual color space which defines color as tint (the degree to which a stimulus can be described as similar to or different from another stimuli that are described as red, green, blue, yellow, and white, can be thought of as hue with white added), saturation (the colorfulness of a stimulus relative to its own brightness), and lightness (the brightness of a stimulus relative to a stimulus that appears white in similar viewing conditions). Proposed by Jean-Christophe Terrillon and Shigeru Akamatsu, TSL color space was developed primarily for the purpose of face detection.

The Animatrix

The Animatrix (アニマトリックス, Animatorikkusu) is a 2003 American–Japanese animated science fiction anthology film produced by the Wachowskis. It is a compilation of nine animated short films based on The Matrix trilogy, which was written and directed by the Wachowskis. Four of the shorts were also written by the Wachowskis. The film details the backstory of the Matrix universe, including the original war between man and machines which led to the creation of the titular Matrix.

This page is based on a Wikipedia article written by authors (here).
Text is available under the CC BY-SA 3.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.