PURPOSE: To enable synchronous tap machining by selecting a control system according to the constitution of a main shaft and a Z shaft.
CONSTITUTION: For synchronous control over the main shaft 20 an Z axis, the numerical controller is provided with a 1st control means which performs feedforward control based upon a ramp function when a motor 17 for main shaft driving and a motor 22 for Z-axis driving are accelerated and decelerated, and a 2nd control means which matches the acceleration/deceleration pattern and gain of the Z-axis with the acceleration/deceleration pattern and gain of the main shaft 20. Then those control means are switched by switching devices 41-43. The control systems can be selected according to the constitution of the main shaft and Z shaft. Consequently, the high-precision synchronous tap machining is performed even by a machine tool whose main shaft and Z-axis differ in constitution.