glm::eulerAngles gives unexpected output for quaternion

I used the euler->mat4->quat to give the right result, but euler->quat gives the wrong result - is there something I did wrong?

glm::quat q(glm::radians(glm::vec3(0, 90, 0)));
glm::vec3 e = glm::eulerAngles(q);
e = degrees(e);

cout << e.x << " " << e.y << " " << e.z << endl;
// Outputs:  0 90 180
// Expected: 0 90 0

//==========================================================

glm::quat q = glm::toQuat(glm::eulerAngleXYX(0.0f, glm::radians(90.f), 0.0f));
glm::vec3 e = glm::eulerAngles(q);
e = degrees(e);

cout << e.x << " " << e.y << " " << e.z << endl;
// Outputs: 0 89.9802 0

$$$$


quat EulerToQuat(float roll, float pitch, float yaw) // roll (x), pitch (Y), yaw (z)
{
// https://en.wikipedia.org/wiki/Conversion_between_quats_and_Euler_angles

quat q;

float cr = cos(roll * 0.5);
float sr = sin(roll * 0.5);
float cp = cos(pitch * 0.5);
float sp = sin(pitch * 0.5);
float cy = cos(yaw * 0.5);
float sy = sin(yaw * 0.5);

q.w = cr * cp * cy + sr * sp * sy;
q.x = sr * cp * cy - cr * sp * sy;
q.y = cr * sp * cy + sr * cp * sy;
q.z = cr * cp * sy - sr * sp * cy;
return q;
}
quat EulerToQuat(const vec3 &v)
{
return EulerToQuat(v.x, v.y, v.z);
}


I am using the method provided by wiki.for now

vec3 e(0.f ,90.f, 0.f);
`