Real Numbers

Prev Next Home Home Table Of Contents Index

REAL NUMBERS

So what's the difference between ordinary numbers and real numbers? Ordinary numbers in MarxMenu are 32 bit integers. These are numbers whose range is about plus or minus two billion. Integers are whole numbers and do not include any fractions.

This is why MarxMenu has included REAL numbers (also known as Floating Point numbers). Real numbers in MarxMenu use BCD (Binary Coded Decimal) with 18 digits of accuracy. They have a range of 10 to the plus or minus 63rd power, which means up to 63 zeros either side of the decimal point. This lets you work with very big and very small numbers. MarxMenu has smart rounding algorithms so that 1.0 / 3 * 3 = 1.0 and not 0.999999999999999999 like in most languages.

Real numbers are specified by using a decimal point. Thus 5.0 specifies a real number. Most normal MarxMenu functions still require the standard 32 bit integers. If you get the error: 'REAL found where INTEGER expected.' You need to use an integer.

If an integer is passed where a real is expected, the integer is automatically converted to a real. Thus:


 6.0 * 3 = 18.0

The Value function returns real numbers if a decimal point is used in the string. All the relevant math functions will work with reals as well as comparison operators.

MarxMenu supports a variety of functions for real numbers. It has trig functions, log functions, and exponential functions. So why do you need real numbers in a menu program? We don't know. The author had a library and threw them in. We figure someone will need them someday.

With real numbers you can do trigonometry calculations like those discovered by the ancient Indian chief Pythagoras who discovered what is now known as Pythagoras's triangle.

Now we know that a lot of you were taught in Math class that Pythagoras was Greek. Well, it's just not so. Here is the real story:

Pythagoras was an Indian chief who had three wives. Two of the wives were twins and weighed 120 pounds each. And they sat next to Pythagoras on a pair of twin deer hides. But Pythagoras also had a third wife who was a large fat woman who sat across from Pythagoras on a hippopotamus hide. This wife weighed 240 pounds.

What Pythagoras discovered was that the squaw on the hippopotamus was equal to the sum of the squaws on the other two hides!

Prev Next Home Home Table Of Contents Index

Sponsors
Shopping
Forum
Forum
email
EMail
Index
Index
Home
Home