Why is the value zero not possible with computers?

Click For Summary

Discussion Overview

The discussion centers around the representation of the number zero in computer systems, particularly in the context of floating point arithmetic. Participants explore the limitations and behaviors of numerical representations in computing, touching on topics such as approximation, precision, and the specific standards used in programming environments like MATLAB.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants suggest that all numbers a computer deals with are approximations, questioning why zero cannot be represented exactly.
  • Others argue that floating point numbers consist of a mantissa and exponent, and while zero can be represented as positive or negative zero, the exponent's role complicates its representation.
  • A participant mentions that MATLAB may not calculate exact zeros due to limitations in precision rather than the inability to store zero itself.
  • Concerns are raised about roundoff errors and how they affect the representation of numbers, particularly in floating point arithmetic.
  • Some participants clarify that integers can be stored exactly, contrasting with the representation of non-integer real numbers.
  • There is mention of alternative methods for representing numbers, such as fractional math, but some participants question their relevance to the original inquiry about standard computing practices.
  • References to external articles and resources are provided to further explore the topic of floating point representation and its implications.

Areas of Agreement / Disagreement

Participants express differing views on the nature of numerical representation in computers, particularly regarding the ability to represent zero. While some agree that zero can be represented, others emphasize the complications arising from floating point arithmetic and precision issues. The discussion remains unresolved with multiple competing perspectives.

Contextual Notes

Limitations include the dependence on specific numerical formats (e.g., IEEE 754) and the context of software applications (e.g., MATLAB's use of different number representations). The discussion highlights the complexity of numerical representation without resolving the underlying issues.

Who May Find This Useful

This discussion may be of interest to computer scientists, software developers, and students studying numerical methods or computer arithmetic, particularly those working with floating point representations and precision issues in programming.

fisico30
Messages
362
Reaction score
0
Hello Forum,
any number that a computer deals with is just an approximation...in what sense?

Why is the number zero not possible? The number zero is often a very very very small number (10^-19) but never exactly zero. Why?

thanks,
fisico30
 
Computer science news on Phys.org
I think the issue is with floating point numbers. They consist of a mantissa and exponent. While you can set the mantissa to zeros an exponent of zero sets the number equal to 1. So the only way to get near zero is to have a large negative exponent. That number format cannot precisely represent zero. I would be surprised if there are not ways to get around this.
 
thank you.
I was doing some MATLAB and looking for zeros but all I could find was very small values, no zeros. The function I was using was supposed to give some zeros but it didn't.

Fisico30
 
Integral said:
I think the issue is with floating point numbers. They consist of a mantissa and exponent. While you can set the mantissa to zeros an exponent of zero sets the number equal to 1.
No, that's not right.

Conceptually, floating point numbers are {sign} {mantissa} X 2{exponent}. Per this wiki page (http://en.wikipedia.org/wiki/IEEE_754-1985), zero can be represented as either positive zero or negative zero, with sign being either 0 or 1, respectively, mantissa being zero for both, and exponent being zero for both.
Integral said:
So the only way to get near zero is to have a large negative exponent. That number format cannot precisely represent zero. I would be surprised if there are not ways to get around this.
 
fisico30 said:
thank you.
I was doing some MATLAB and looking for zeros but all I could find was very small values, no zeros. The function I was using was supposed to give some zeros but it didn't.
This isn't a problem of the computer not being able to store zero (which it can), but of the software not being able to calculate precisely enough to find a value for which the function value was exactly zero.
 
fisico30 said:
any number that a computer deals with is just an approximation...in what sense?
This is not true in general. Computers can store many integer values exactly. As already mentioned in this thread, the problem comes with how non-integer real numbers are stored.
fisico30 said:
Why is the number zero not possible? The number zero is often a very very very small number (10^-19) but never exactly zero. Why?
10^(-19) is NOT zero. It's pretty small, but it isn't zero.
 
IEEE 754 specifies signed zeroes in its floating point standard.
+0 = -0 = 0, so it is possible for zero to be represented on a computer.

How else would we get "Error: Divide by zero" messages?
 
fisico30 said:
Hello Forum,
any number that a computer deals with is just an approximation...in what sense?

Why is the number zero not possible? The number zero is often a very very very small number (10^-19) but never exactly zero. Why?

thanks,
fisico30

Mark has pretty much covered it except for pointing out that SOME floating point numbers are represented exactly, NOT approximately as you seem to think, while some ARE represented as approximations.

All integers are represented exactly UP TO THE LIMIT of the computers ability to express integers. For an 8-bit computer (the VERY early kind) that was 256. For a 16-bit computer, that's 65536, and so forth.

Perhaps it will help you understand the "approximation" business if you think of a decimal computer that has the ability to represent 10 significant digits.

How would that computer represent the answer when doing the division 1/3 ? Well, it would be .3333333333 which is only an approximation because of the necessary rounding. Binary computer have the same problem, just in binary.
 
  • #10
phinds said:
How would that computer represent the answer when doing the division 1/3?
One option, available on some calculators, and in some libraries for computers, is fractional math, where numbers are are stored as fractions with integer numerators and denomiators. I'm not sure how practical this is versus being a novelty feature found on some calculators.
 
  • #11
rcgldr said:
One option, available on some calculators, and in some libraries for computers, is fractional math, where numbers are are stored as fractions with integer numerators and denomiators. I'm not sure how practical this is versus being a novelty feature found on some calculators.

Seems pretty likely that the OP is talking about normal computers, so this is not relevant.
 
  • #12
phinds said:
Seems pretty likely that the OP is talking about normal computers, so this is not relevant.

It is relevant for 'normal' computers as it is application dependent. Standard Matlab (which the OP uses) uses the IEEE format for calculation, which will result in the observed 'non-zero' zeros. However, the Matlab Symbolic Toolbox uses a bignum format and may well (depending upon the type of the number) store numbers as rationals.

Mathcad's symbolic processor works in a similar fashion as does Mathematica and at least a few other symbolic applications.
 
  • #13
Seems to me that this is a roundoff-error issue. I've seen it a lot myself.

The only rational numbers that can be represented with a finite number of trailing digits in some number-base system are those whose denominators are nonnegative-integer powers of the base. Otherwise one gets an infinitely-repeating finite sequence of digits after some finite number of initial digits. Irrational numbers are even worse. They cannot be represented with a finite number of trailing digits in *any* base.

It's possible for computers to work with integers and floating-point numbers with arbitrarily high numbers of digits, limited only by the available memory. One has to work with arrays of digits, but it's feasible. It's also possible for computers to work with exact rational numbers as pairs of integers. It's easy to write functions that implement the rules for manipulating fractions.

You can find all this in The GNU MP Bignum Library and in various computer-algebra packages.

I implemented rational numbers myself for the C++ version of my semisimple-Lie-algebra software, because I wanted something faster than GMP. I did it as a template class, with a parameter: the type of integer.
 
  • #14
NemoReally said:
It is relevant for 'normal' computers as it is application dependent. Standard Matlab (which the OP uses) uses the IEEE format for calculation, which will result in the observed 'non-zero' zeros. However, the Matlab Symbolic Toolbox uses a bignum format and may well (depending upon the type of the number) store numbers as rationals.

Mathcad's symbolic processor works in a similar fashion as does Mathematica and at least a few other symbolic applications.

Fair enough, but I was talking about the computer at the hardware level, as I believe the OP was, not applications.
 
  • #15
lpetrich said:
Seems to me that this is a roundoff-error issue ...

Yes, exactly.
 

Similar threads

  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 21 ·
Replies
21
Views
4K
  • · Replies 47 ·
2
Replies
47
Views
7K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 44 ·
2
Replies
44
Views
6K
Replies
17
Views
2K
Replies
5
Views
2K
  • · Replies 22 ·
Replies
22
Views
4K