A numerical controller providing machining for a workpiece by controlling a wire electric discharge machining device, the wire electric discharge machining device having an XY axis adapted to control the workpiece relatively with respect to a wire electrode in a horizontal direction and a UV axis adapted to control at least either one of an upper wire guide and a lower wire guide in the horizontal direction, the numerical controller comprising: a perpendicular setting control unit configured to cause the wire electrode to be oriented perpendicular to the workpiece by controlling at least either one of the XY axis and the UV axis and causing the wire electrode to be oriented in parallel with a direction in which a machining start hole extends, the wire electrode being inserted into and extending through at least one machining start hole provided in and perpendicular to the workpiece; an inclination degree calculation unit configured to calculate an inclination of the workpiece with respect to the XY axis on the basis of a position of the UV axis in response to the wire electrode being made to be perpendicular to the workpiece by the perpendicular setting control unit; a machining start hole diameter calculation unit configured to calculate a diameter of the machining start hole by controlling the XY axis and detecting a short-circuit state between the wire electrode and an inner wall of the machining start hole; an upper-location-of-center calculation unit configured to obtain a location of a center of an upper portion of the machining start hole by controlling a relative position of the upper wire guide relative to the workpiece and detecting the short-circuit state between the wire electrode inserted into and extending through the machining start hole and the inner wall of the machining start hole; a lower-location-of-center calculation unit configured to obtain a location of a center of a lower portion of the machining start hole by controlling a relative position of the lower wire guide relative to the workpiece and detecting the short-circuit state between the wire electrode inserted into and extending through the machining start hole and the inner wall of the machining start hole; and a workpiece placement error correction amount calculation unit configured to calculate an amount of correction of the upper wire guide with respect to the workpiece on a surface of the upper wire guide and calculate an amount of correction of the lower wire guide with respect to the work piece on a surface of the lower wire guide on the basis of the inclination of the workpiece calculated by the inclination degree calculation unit, the diameter of the machining start hole calculated by the machining start hole diameter calculation unit, the location of the center of the upper portion of the machining start hole calculated by the upper-location-of-center calculation unit, and the location of the center of the lower portion of the machining start hole calculated by the lower-location-of-center calculation unit. a perpendicular setting control unit configured to cause the wire electrode to be oriented perpendicular to the workpiece by controlling at least either one of the XY axis and the UV axis and causing the wire electrode to be oriented in parallel with a direction in which a machining start hole extends, the wire electrode being inserted into and extending through at least one machining start hole provided in and perpendicular to the workpiece; an inclination degree calculation unit configured to calculate an inclination of the workpiece with respect to the XY axis on the basis of a position of the UV axis in response to the wire electrode being made to be perpendicular to the workpiece by the perpendicular setting control unit; a machining start hole diameter calculation unit configured to calculate a diameter of the machining start hole by controlling the XY axis and detecting a short-circuit state between the wire electrode and an inner wall of the machining start hole; an upper-location-of-center calculation unit configured to obtain a location of a center of an upper portion of the machining start hole by controlling a relative position of the upper wire guide relative to the workpiece and detecting the short-circuit state between the wire electrode inserted into and extending through the machining start hole and the inner wall of the machining start hole; a lower-location-of-center calculation unit configured to obtain a location of a center of a lower portion of the machining start hole by controlling a relative position of the lower wire guide relative to the workpiece and detecting the short-circuit state between the wire electrode inserted into and extending through the machining start hole and the inner wall of the machining start hole; and a workpiece placement error correction amount calculation unit configured to calculate an amount of correction of the upper wire guide with respect to the workpiece on a surface of the upper wire guide and calculate an amount of correction of the lower wire guide with respect to the work piece on a surface of the lower wire guide on the basis of the inclination of the workpiece calculated by the inclination degree calculation unit, the diameter of the machining start hole calculated by the machining start hole diameter calculation unit, the location of the center of the upper portion of the machining start hole calculated by the upper-location-of-center calculation unit, and the location of the center of the lower portion of the machining start hole calculated by the lower-location-of-center calculation unit.