Saturday, July 30, 2011

Fractional Story

While teaching a topic of computer organization in class, I came across the interesting concept of fractions! The topic was- fractions having denominator of zero. Generally, when computer solves the expressions with denominator of zero, they treat integer and floating point arithmetic differently. The reason is that integer and floating point arithmetic formats in the computer are totally different and they are solved with the help of different arithmetic units. If 8086 processor is concerned, floating point operations were solved by coprocessor 8087. Now internally, processor ALU solves such mathematics with the help of separate FPU i.e. floating point unit.

Actually, the word fraction means a part of a whole. In mathematics, it is denoted by two numbers who are separated by ‘–‘ or ‘/’. Division of two numbers is done with the help of these two different signs. The rule of mathematics tells that when numerator is zero the result of the fraction is zero. It does not matter what denominator is? Zero divided by a number is always zero. If numerator is smaller than denominator such as 4/9 then this fractions is called as proper fraction. But for the inverse case it is improper fraction. One more term common or vulgar fraction is used in mathematics. When fractions is obtained by dividing an integer by integer then it is vulgar fraction. So both proper and improper fractions are vulgar fractions!

When in a C program we divide a float number and 0.0 it gives floating point error of domains. One interesting this is that when 0.0 is divided by 0.0 then the result given is different! In Java programming language, 0.0 / 0.0 is a special case where the output is defined by a constant called NaN i.e. Not A Number! But when a float number is divided by 0.0 then it is either Infinity or –Infinity. The computer has made this case specialized only for floating point numbers! When integer zero is divided by another integer zero or an integer number is divided by zero then computer always given divide by zero error, which is actually a run-time error. No programming language of computer is exception for it.

A strange thing that I would like to mention here is that every year Washington Post newspaper publishes a list of favourite top ten T-shirt slogans. One of them is “Five out of four people don’t understand fractions!!!”. It is really strange but true! American preacher and author told that, when life ceases to be a fraction becomes an integer…

No comments:

Post a Comment