I'm doing homework about L'Hôpital's rule and there's a question that I'm not sure I answered right.

I had to find the limit of (x^2 \* sin(1/x))/sin(x) as x approaches 0, and after L'Hôpital

(2x \* sin(1/x) + x^2 \* cos(1/x))/cos(x)

Here I realized that I could use the rule as much as I wanted but the discontinuities in the numerator were always gonna be an issue. However, since the limit of 1/x is infinity as x approaches 0 and the limit of sin and cos is undefined at infinity, I thought I could just ignore those undefined terms and take the limit with the rest of the function. I got the right result, but I'd like to know if my logic is correct and how I should write it formally if it is. I just took out sin(1/x) and cos(1/x) and computed the limit without them.