and three bent leg pieces 13d formed on an outer peripheral edge thereof by bending the housing 13 is securely mounted on the top surface of a rotating machine 15 by means of a plurality of screws 14 the rotating machine 15 has a rotary shaft 16 which extends upwardly through the center hole 13b of the housing 13 and a magnetic drum 17 is securely mounted on the rotary shaft 16 the magnetic drum 17 includes a rotary member 18 made of aluminum or some other suitable metal and a magnetic member 19 made of plastic magnet or the like and securely mounted on the outer circumferential face of the rotary member 18 the magnetic member 19 has a magnetization pattern not shown formed continuously on the outer circumferential periphery thereof by a magnetic recording technique such that a plurality of magnetic pole pairs are arranged at equal circumferential intervals so that adjacent successive pairs of magnetic poles have the polarities n s s n n s s n the magnetic rotary encoder further includes a magnetic sensor 20 secured by an adhesive to a sensor retainer 21 the magnetic sensor 20 may include for example a pair of magneto resistance effect elements which are arranged in a circumferentially spaced relationship and separated by a distance equal to np 1 4 u00b7 p where p is a pitch of the magnetic poles of the magnetization pattern on the magnetic drum 17 and n is an integer magnetic sensor 20 faces.