Rotatearound produces unwanted rotations

I appreciate this may be covered in other questions but I can’t find a detailed reply.

I have two rotatearound() functions in sequence. The first one rotates around the target axis in X, the other in Z. When playing the script, I get an unwanted Y rotation. Commenting each line yields correct behavior of the rotation that is enabled.

FYI - the angle_pitch / roll are defined as arrays of floats, this data is GPS data and is a long array so I have simplified and shortened it below.

private float[] angle_pitch ={0.1f,0.15f,0.5f....0f};
private float[] angle_roll ={0.1f,0.15f,0.5f....0f};

void Update()
        timer += Time.deltaTime;
        waitTime = 50 / angle_roll.Length;
        if (timer > waitTime)
        { // check if enough time passed

            // Reset timer
            timer = timer - waitTime;

            if (curStep == angle_roll.Length)
            { // reset the step back to zero
                curStep = 0;

                transform.RotateAround(point.position, point.forward, angle_pitch[curStep]);  //forward = pitch = z = blue
                transform.RotateAround(point.position, point.right, angle_roll[curStep]);  //right = roll = x = red
                curStep += 1; // Add one to current step



Solved: A floating point error builds over time, reset the translation back to its initial state at curStep=0 fixes the issue.