the problem of equating float with transform rotation

i want to make the float same as transform rotation, so this my script :

float rotX;
     rotX = cam.transform.rotation.x;

sometimes the number is equal
sometimes is not
how can i equalize value ??
and how can i to clamp it ??

use rotX = cam.transform.eulerAngles.x; instead. link text link text

EDIT: Okay, you probably need localEulerAngles instead. Sorry.