41.7 mwould be the top deck width, 40 m would be just below the stern opening, where the hangar deck level should be.
But do we have any reason to believe the stern opening corresponds to the hangar deck level?
After all, we have pictures showing us just how tall the stern opening is (not very, certainly not enough for an aircraft)...

and when looking at earlier rare pictures of the hangar modules being installed where not even the floor of the hangar is visible, the unable-to-visualize hangar deck floor would still correspond quite a bit lower than the stern opening as well, perhaps 2 decks lower.

That said, I do at least understand where you got the 41.7m number from.
The issue is I don't think we have any pictures so far that allows us to try and extrapolate the stern flight deck level width from the hangar deck level width, because we don't have any pictures that we can extrapolate the former convincingly from the latter.
But fortunately one thing we do definitively know is the width of the drydock (82 meters), and which there are enough pictures of both the stern flight deck level and said drydock....
I won't belabour the point furthe.r