You asked
Pentax smc da 40mm f 2 8 xs vs pentax hd da 40mm f 2 8 limited?
The two lenses are near-identical on paper. Both are 40mm f/2.8 pancakes for Pentax K-mount APS-C cameras. Both are unstabilised with autofocus, and both frame like a 60mm lens on full frame, with depth of field about that of f/4.2 there. The guide's focal length converter explains why the crop factor changes the background blur. The guide's pages don't say which is sharper or better built, and they don't compare prices, so the choice comes down to size and what you value in the lens.
The Pentax smc DA 40mm f/2.8 XS is the slimmer of the two, described as an ultra-thin pancake even slimmer than the Limited. Pick it if you want the smallest possible kit for everyday walking-around shooting.
The Pentax HD DA 40mm f/2.8 Limited is the one in Pentax's Limited line. It is still compact, but it is not as thin. Choose it if the Limited name matters to you or you prefer its handling.
Both fit the same bodies, so the camera decision doesn't separate them. For a current APS-C body, the Pentax K-3 Mark III and Pentax KP both take either lens. Both are APS-C, and the full-frame K-1 bodies can use either lens only in APS-C crop mode.
Written by Claude from this site's pages.
From these pages
This answer is for the question above. Each answer is written for the exact question in its address, so a question with its details in it (a budget, what you shoot, what you already have) gets an answer about those details. An answer draws on all 15 pages of the guide and its catalogue of 320 cameras and 1050 lenses. Another question gets its own answer at its own address, as words after /ask/. Or fill in your own: /ask/which-camera-for-{what-you-shoot}-under-{budget}-euros or /ask/which-lens-for-{what-you-shoot}-on-{your-camera}.