What are you trying to do with it?
When you say yaw, say I'm pitched forward 45°, is the yaw still about the vertical axis or 45° to vertical. Likewise with yaw and roll. Because of these ambiguities, it's rather complex. You may want to google quaternions and spacial rotation.
A simpler method would use a 2 axis accelerometer to act as an inclinometer and so provide pitch and roll relative to earth and a compass to give yaw. However, once you go much above 30° from vertical you will start to get problems.
Mike.