On 6/7/05, Vivek Khurana hiddenharmony@gmail.com wrote:
On 6/7/05, Ramanraj K ramanraj.k@gmail.com wrote:
While doing arithmetic, how is infinity represented on a computer?
well use some arbitrary large number which is out of bounds from the current set being operated upon.
Joe Steeve wrote:
There is no such thing as infinity in a computer. When a integer is divided by zero., the CPU will throw an exception.
Take the following equation:
sqrt{1 + 2 sqrt{1 + 3 sqrt{1 + 4 sqrt{1 + ...} } } } = 3
Ramanujam proved the equation to be true. Please paste the above equation into OpenOffice Math and it would be more clear. In this equation, we cannot use "some arbitrary large number" as Vivek suggests and division by zero is not the only use for infinity. (BTW division by zero is assumed to be infinity and afaik there is no proof for that).
There should be a way to represent ... or infinity in the above equation on computers. If there are no standard ways of doing it then, we should devise a way to do it. It is fairly important to be able to represent infinity on computers just as easily as we represent numbers, because it has many practical uses as well. We may have to define max and min values for variables, and sometimes it has to be set at infinity.
If there are no standards for this, then: [1] A special character could represent infinity (lemniscate : sleeping 8 :) or three dots ...
AND/OR
[2] The last bit could be used to represent infinity. If a n bit word is used to represent integers, then the allowed integers have values between -2^(n-1) and (2^(n-1)) - 1. The maximum integer value could be reserved to represent infinity
Whenever I had to represent infinity, I had used this notation: Suppose for a variable x the max value is set to 3 and min value is set to 0, then x could be any number between 0 and 3. If max is set to 0, and min is not 0, then it represents infinity, x could represent any value from min to infinity. This works fine when min would always be greater than 0, but if x would have to start from 0 then solution [1] or [2] becomes necessary.