Maximum Rotation (16601)

Hey, here is a new one for you!

I want a maximum and minimum angle and I came up with this

function Update () {
    if (transform.eulerAngles.y > 10)
        transform.eulerAngles.y = 10;
    if (transform.eulerAngles.y < -10)
        transform.eulerAngles.y = -10;
}

But for some reason it's making my object rotate but kinda stutterly. This object is being moved by mouse with this script:

static var autoRotate : boolean;
var rotateSpeed : float = 10;
var MousePos : float;
var XPos : float = 0;

function OnMouseDown () {
    autoRotate = true;
}

function OnMouseUp () {
    autoRotate = false;
}

function LateUpdate () {

MousePos = Input.GetAxis("Mouse X");
XPos = (-MousePos * rotateSpeed);

    if (autoRotate) 
        transform.Rotate(Vector3.up * XPos);

}

Now I my question; where do I, or Unity, go wrong?

this bit

function Update () {
    if (transform.eulerAngles.y > 10)
        transform.eulerAngles.y = 10;
    if (transform.eulerAngles.y < -10)
        transform.eulerAngles.y = -10;
}

should be like this

function Update ()
{
    if (transform.eulerAngles.y >= 10)
        transform.eulerAngles.y = 10;
    if (transform.eulerAngles.y <= -10)
        transform.eulerAngles.y = -10;
}

and change your floats to ints. As far as I know int will work with decimal placing and floats will not. Maybe just the way that I'm using them but it's working for us so worth a try.