Printed from Kezuriba (kezuriba.net/en/nc/decimal-point/)
Decimal Point Input: Is X1000 1000 mm or 1 mm?
In NC programs, a number written with a decimal point, such as X100. is read as 100 mm on any machine. But a number without a decimal point, such as X1000 , can be 1000 mm, 1 mm or even 0.1 mm, depending on the machine setting. This is the cause of accidents in which a program brought over from another machine or from CAM moves the tool to a place off by a factor of 1000. This page covers the two ways of reading and the exceptions for each address.
Diagram: how X1000 without a decimal point is read (compared on the same scale)
.Two ways of reading: calculator-type and standard type
- Calculator-type (pocket calculator type): a number without a decimal point is read as mm, inch or degrees as it is.
X1000is 1000 mm[1]. - Standard type: a number without a decimal point is multiplied by the least input increment (the smallest amount the machine can command) to get its value. There are two kinds of least input increment, IS-B and IS-C. With IS-B,
X1000is 1000 × 0.001 = 1 mm, and with IS-C it is 1000 × 0.0001 = 0.1 mm[1]. - FANUC-compatible NCs are standard type by default, and some models can be switched to calculator-type by a setting. A number written with a decimal point (
X1000.) is 1000 mm under either reading[1][3].
Where it is set and how to check it
- How a number is read is set by a machine parameter. The Siemens ISO dialect selects it with machine data MD 10884, and Mitsubishi Electric with parameter #1078 (decimal point input type I = read in least input increments, type II = read in mm)[2][3]. Even NCs from the same maker may be set differently from machine to machine.
- Do not move the machine to find out. Moving an axis with a value that has no decimal point is itself an accident. First look at the parameter screen, or ask the machine builder.
- The fix on the programming side is simple: always put a decimal point on lengths, angles and feeds. That way, the program behaves the same on a machine with either setting.
Calculator: how this word is read (mm, seconds…)
| Word | Address type | Value as read |
|---|
The conversion factors follow the table in the Siemens ISO dialect manual (mm, inch, IS-B, IS-C). Which reading your machine uses is set by a parameter (MD 10884 on the Siemens ISO dialect, #1078 on Mitsubishi Electric). Do not test it by moving the machine: check the parameter screen or ask the machine builder first. Some controls have exceptions not covered here.
Units by address (standard type, in mm)
What the number 1 without a decimal point stands for. Compiled from the table in the Siemens ISO dialect manual[1]. In this table, the addresses whose reading changes are X Y Z U V W A B C I J K Q R F.
| Address | Standard type IS-B | Standard type IS-C | Calculator-type |
|---|---|---|---|
| Linear axes X Y Z U V W | 0.001 mm | 0.0001 mm | 1 mm |
| Rotary axes A B C | 0.001° | 0.0001° | 1° |
| Arc center I J K, radius R, Q | 0.001 mm | 0.0001 mm | 1 mm |
| F (feed per minute) | 1 mm/min | 1 mm/min | 1 mm/min |
| F (feed per revolution) | 0.01 mm/rev | 0.01 mm/rev | 1 mm/rev |
| F (thread lead) | 0.01 mm | 0.01 mm | 1 mm |
| X, U of dwell G04 | 0.001 s | 0.001 s | 1 s |
For inch, a linear axis is 0.0001 inch with IS-B and 0.00001 inch with IS-C[1]. Example with dwell: G04 X1000 is 1 second in standard type and 1000 seconds in calculator-type (it stops for nearly 17 minutes)[2].
×Addresses where the decimal point has no effect
The Mitsubishi Electric manual lists D H L M N O P S T as “addresses where the decimal point is invalid”; even if you add a decimal point, the fractional part is dropped and the value is read as an integer[3]. These are numbers (N, O, T, H, D), counts (L), spindle speed (S), M-codes and so on. Even if you write S1000.5 , it is still read as 1000.
Exceptions within the same NC (easy to get wrong here)
- Thread start angle Q: In Haas G32, Q is an integer in units of 0.001°, and you must not add a decimal point (180° is
Q180000). The Siemens ISO dialect, by contrast, adds a decimal point and writesQ180.(in degrees)[4][2]. Even for the same “second start of a multi-start thread”, the way of writing is the exact opposite. - P and Q in line 2 of G76 (thread height and first depth of cut): write them as integers in least input increments, with no decimal point (
P1534 Q450is 1.534 mm and 0.45 mm). For details, see G76 of the lathe multiple repetitive cycles. - P of dwell:
G04 P500, the P is an integer with no decimal point (milliseconds). When you write it with X or U, add a decimal point:G04 X0.5. - Mitsubishi Electric threading F: F without a decimal point is also read as the integer part in mm, not in least input increments (
F1is 1 mm)[3]. This is read differently from F for feed per revolution.
Diagram: start angle Q of a multi-start thread (seen from the end face)
Expressions, variables and macro arguments
- Values made with expressions or variables are treated as having a decimal point. Mitsubishi Electric reads
X123+0as 123 mm, and all variable values carry a decimal point[3]. - Conversely, when you call a macro, the Argument may be read in the least increment if they have no decimal point. According to the Haas manual, with an mm setting, writing
A1makes #1 0.001[5]. Write arguments likeA1.— in other words, always include the decimal point. For details, see G65 in the introduction to custom macros.
Differences between NCs
| NC | Numbers without a decimal point | Points to watch |
|---|---|---|
| FANUC-compatible | Standard type by default; some models can be switched to calculator-type by a setting | P and Q in cycles are integers in least input increments |
| Mitsubishi Electric | Select type I (least input increment) or type II (mm) with #1078[3] | D H L M N O P S T drop the fractional part. F for threading is read as the integer part in mm |
| Siemens (ISO dialect) | Select calculator-type or standard type with MD 10884. The standard-type factors are IS-B and IS-C[1][2] | Q for multi-start threads takes a decimal point (Q180.) |
| Haas | There are cases where an argument without a decimal point is read in the least increment[5] | Q of G32 is an integer without a decimal point (Q180000)[4] |
| LinuxCNC | A number without a decimal point is read as its face value (in effect, calculator-type)[6][7] | Bringing in a FANUC-type program written without decimal points shifts values by a factor of 1000 |
Shop-floor checklist
- Put a decimal point on every X, Y, Z, U, W, I, J, K and R (
X30rather thanX30.) - Put a decimal point on F too (
F0.2,F150.) - Wrote P and Q in cycles (line 2 of G76, G04 P) as integers without a decimal point, as the manual specifies
- Matched Q for multi-start threads to the way that machine writes it (with or without a decimal point)
- Put a decimal point on macro arguments (
A1.) - When reusing a program from another machine or from CAM, searched it for numbers left without a decimal point
- Confirmed the machine's decimal point input setting (calculator-type or standard type, IS-B or IS-C) on the parameter screen or with the machine builder
Related: Introduction to NC Lathe Programming (try forgetting a decimal point in the simulator), Canned cycle list (sign and decimal point of Q), G32 threading, Codes with clashing numbers
Sources
A summary, in Kezuriba's own words, of the key points of each maker's public documents. Text and tables from the manuals are not copied.
- Siemens AG「SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Milling, 04.2007 Edition (6FC5398-7BP10-0BA0)」 cache.industry.siemens.com
- Siemens AG, "SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Turning, 04.2007 Edition" cache.industry.siemens.com
- Mitsubishi Electric“MITSUBISHI CNC 700/70 Series Programming Manual (Lathe System) (IB-1500057)” mitsubishielectric.com
- Haas Automation, Inc.“G32 Thread Cutting (Group 01) (lathe, per-code explanation page)” haascnc.com
- Haas Automation, Inc.“Mill Operator's Manual – 13 Macros (online version)” haascnc.com
- LinuxCNC project“G-code Overview (LinuxCNC Documentation)” linuxcnc.org
- National Institute of Standards and Technology (NIST)「The NIST RS274NGC Interpreter – Version 3 (NISTIR 6556, 2000)」 nvlpubs.nist.gov