Good day!
Explain, please, what does it mean that in the computer the addition operation is not additive?
Good day!
Explain, please, what does it mean that in the computer the addition operation is not additive?
I suspect that such a formulation is not entirely correct, because it is not clear what “in computer” means and what “addition operation” means. But I will answer, as I understood.
Whatever the computer, its memory is limited. If we are talking about numbers in the registers of the processor, then there is always a maximum number, and if we add one to it, we get the minimum number, and not what we expected. Let's say we have 8 bits with a sign. The maximum number will be 0x7F = 127 , we add one, we get 0x7F+1 = 0x80 = -128 . The additivity property is violated.
Further, in floating arithmetic is even worse. The simplest example: adding the large and small numbers together, we get not their sum, but again we get a large number. Let's say 1e30+1e-30=1e30 .
The same can be said about long arithmetic. Sooner or later the memory will end - and the attempt to add two numbers will fail ... but there is already a philosophical question, to consider this failure as an addiction violation or not.
Source: https://ru.stackoverflow.com/questions/603151/
All Articles