You are here: Home / Hidden_Study / Mel / Values and variables / Integer and floating point numbers

Integer and floating point numbers

Integers

Integers are numbers without a fractional part. For example:

5
-20
0
32000

Floating point numbers

Floating point numbers (or floats) have a fractional part. For example:

3.1415926
2.0
-6592.582
0.0

MEL and Maya maintain the distinction between integer and floats because computers can work with integers many times faster with integers than with floating point numbers. Whenever you are doing something that does not require fractional precision (for example, simple counting), use integers instead of floats.

Non-decimal numbers

You can type integers using hexadecimal (base 16) notation by adding 0x to the beginning of the number:

0xA0 // equals 160
0xFFF // equals 4095
Filed under: , , , , ,
OpenID Login