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
128802-same.png
sometimes is not
128803-diffrent.png
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.