Next: 10.3 Words Up: 10. G Code Basics Previous: 10.1 Blocks   Contents   Index

# 10.2 Numbers

Since every nc word is composed of a letter and a value. Before we begin a serious discussion of the meaning of nc programming words we need to consider the meaning of value within the interpreter. A real_value is some collection of characters that can be processed to come up with a number. A real_value may be an explicit number (such as 341 or -0.8807), a parameter value, an expression, or a unary operation value. In this chapter all examples will use explicit numbers. Expressions and unary operations are treated in the computation chapter. The use of parameter values or variables are a described in detail in the Using Variables chapter.

EMC uses the following rules regarding numbers. In these rules a digit is a single character between 0 and 9.

A number consists of :

• an optional plus or minus sign, followed
• by zero to many digits, followed, possibly, by
• one decimal point, followed by
• zero to many digits provided that there is at least one digit somewhere in the number.
There are two kinds of numbers: integers and decimals. An integer does not have a decimal point in it; a decimal does.

• Numbers may have any number of digits, subject to the limitation on line length.
• A non-zero number with no sign as the first character is assumed to be positive.
• Initial and trailing zeros are allowed but not required.
• A number with initial or trailing zeros will have the same value as if the extra zeros were not there.
Numbers used for specific purposes in RS274/NGC are often restricted to some finite set of values or to some range of values. In many uses, decimal numbers must be close to integers; this includes the values of indexes (for parameters and changer slot numbers, for example). In the interpreter, a decimal number which is supposed be close to an integer is considered close enough if it is within 0.0001 of an integer.

Next: 10.3 Words Up: 10. G Code Basics Previous: 10.1 Blocks   Contents   Index
root 2003-05-26