Problem with child rotation

Hello, before i proceeding here i already searched the best solution but i couldnt solve the problem.

I have a main character(child) that belongs to main character object(parent) (they are equivalent on name only, pardon for confusing), i need to rotate the child main character so it is facing to left, right, forward backward same as god of war if you know it.

my problem is i cant set the exact value for child main character’s rotation y axis and it gave weird value. if i set the y axis to 90 degree the debug.log method shows the value of decimal numbers such as 0.7000… something. If i look the child’s transform rotation it displayed not exactly like 90 but more than 90.
Im already confused.
I dont know how to solve this kind of issue since im still a beginner.

ill show you my code,

public float rightValue = 0.0f;
private GameObject childPlayer;

void Start () 

{
    childPlayer = GameObject.FindGameObjectWithTag("Child Player");
}

void Update () 

{
    if (Input.GetKey(KeyCode.W))

    {
        rightValue = 90.0f;
        if (rightValue >=90.0f)
        {
            childPlayer.transform.localRotation = Quaternion.Slerp(Quaternion.identity, new Quaternion(0, rightValue, 0, 0), .5f);
            childPlayer.animation.CrossFade("idle Run Forward");
        }
        else
        {
            
        }
    }
    else
    {
        childPlayer.animation.CrossFade("idle 01");
    }
}

Please help me. Thank you in advance
Im using the CharacterController class to control the main character parent.

Ok so you are trying to modify the individual properties x,y,z,w of a Quaternion - this isn’t a good idea unless you happen to be good at visualising 4 dimensional space! Those properties do not represent real world angles. Instead you should use Quaternion.Euler which converts x,y,z rotations into a Quaternion for you.

Secondly - your Slerp is always going to return a single value half way between Quaternion.identity and whatever you set the target to - that’s because you are using a fixed 0.5f value in the time parameter. It would give you a basic damped rotation if you used Quaternion.Slerp(childPlayer.transform.localRotation, Quaternion.Euler(0, rightValue, 0), 0.5f). To accurately Slerp between two locations over a fixed time you need to initialise a time variable to 0 and then add Time.deltaTime to it each frame.