Habitability is a matter of perception and expectation. U-boat crews were used to living and fighting in very cramped condition and knew that no alternative was available. In contrast, the dreadnought crews, used to more spacious accommodation ashore, were less experienced with and less used to the cramped accommodation on board ship - even though that accommodation would probably have been regarded very favourably by the U-boat crews! The lack of experience with shipboard conditions would presumably manifest itself as a loss of fighting efficiency and morale during a prolonged cruise.
So strict comparisons of conditions can be unreliable, we need to account for the nature, experience and expectations of the crews too.
So strict comparisons of conditions can be unreliable, we need to account for the nature, experience and expectations of the crews too.