An electric rotating machine comprising: an output shaft of the electric rotating machine; a magnetic body fixed inside a case of the electric rotating machine and surrounding the output shaft; a sensor magnet (27, 27a, 27b) fixed to the output shaft and generating a magnetic field for detecting a rotational angle of the output shaft; and a rotation sensor (26, 26a, 26b) fixed inside the case of the electric rotating machine, arranged between the magnetic body and the sensor magnet (27, 27a, 27b) in an axial direction of the output shaft and outputting a signal in accordance with the intensity of the magnetic field for detecting the rotational angle, wherein an N-pole and an S-pole are magnetized in a circumferential direction around the output shaft in the sensor magnet (27, 27a, 27b), characterized in that the rotation sensor (26, 26a, 26b) is arranged in an area in which, the amplitude ratio between a radial-direction component and a circumferential-direction component around the output shaft of the magnetic flux density of the magnetic field is "k", an n-order ("n" is an even number) angle error fn (k) expressed by the amplitude ratio "k" satisfies a required rotational angle detection accuracy E by the electric rotary machine, wherein n-order angle error fn (k) is defined by the following functions: { f 2 k = − k − 1 35 k 4 + 58 k 2 + 35 2 k 30 k 4 + 52 k 2 + 46 f 4 k = 8 k − 1 k 4 − 1 2 k 30 k 4 + 52 k 2 + 46 f 6 k = − k − 1 3 k 4 − 6 k 2 + 3 2 k 30 k 4 + 52 k 2 + 46 wherein the amplitude ratio "k" is different from 1 and the required rotational angle detection accuracy E is defined by the following functions { f 2 k ≤ E f 4 k ≤ E f 6 k ≤ E an output shaft of the electric rotating machine; a magnetic body fixed inside a case of the electric rotating machine and surrounding the output shaft; a sensor magnet (27, 27a, 27b) fixed to the output shaft and generating a magnetic field for detecting a rotational angle of the output shaft; and a rotation sensor (26, 26a, 26b) fixed inside the case of the electric rotating machine, arranged between the magnetic body and the sensor magnet (27, 27a, 27b) in an axial direction of the output shaft and outputting a signal in accordance with the intensity of the magnetic field for detecting the rotational angle, wherein an N-pole and an S-pole are magnetized in a circumferential direction around the output shaft in the sensor magnet (27, 27a, 27b), characterized in that the rotation sensor (26, 26a, 26b) is arranged in an area in which, the amplitude ratio between a radial-direction component and a circumferential-direction component around the output shaft of the magnetic flux density of the magnetic field is "k", an n-order ("n" is an even number) angle error fn (k) expressed by the amplitude ratio "k" satisfies a required rotational angle detection accuracy E by the electric rotary machine, wherein n-order angle error fn (k) is defined by the following functions: { f 2 k = − k − 1 35 k 4 + 58 k 2 + 35 2 k 30 k 4 + 52 k 2 + 46 f 4 k = 8 k − 1 k 4 − 1 2 k 30 k 4 + 52 k 2 + 46 f 6 k = − k − 1 3 k 4 − 6 k 2 + 3 2 k 30 k 4 + 52 k 2 + 46 wherein the amplitude ratio "k" is different from 1 and the required rotational angle detection accuracy E is defined by the following functions { f 2 k ≤ E f 4 k ≤ E f 6 k ≤ E