A controller includes a rotating direction detecting unit 34 to detect the rotating direction of a
servo motor 6, a reversing distance computing unit 31 to compute a rotating angle of the
servo motor 6, a rotation resistance computing unit 35 to compute rotation resistance on the
servo motor side 6, and an elastic deformation error amount computing unit 21 to compute a deformation error amount of a
ball screw 3. In the controller, when the rotating direction detecting unit 34 detects reverse of the servo motor 6, the rotation resistance computing unit 35 computes rotation resistance based on a rotating angle δθ of the servo motor 6 after the servo motor is reversed. The elastic deformation error amount computing unit 21 computes the elastic deformation error amount δ based on the computed rotation resistance. Thereby, a position command value inputted into the
position control unit 14 can be corrected.