I'm a jack of all uses, durable and strong,
but useful in childish construction too.
Desired alike by man- and women-kind;
wanted by most all, obtained but by few.
When shortened, I'm an impartial judge of prisoners in math;
Some are changed; all set free.
But for a discrete gift, the whole truth I'll gladly tell
if I'm used programmatically.
What am I?
(spacing is intentional)
Edit for slight hint, since everyone's guesses seem too general:
Every line, as well as the title, is specifically necessary (though the second verse could be applied to a number of things. But to extend that verse: the only people who can obtain (the answer) are those who can stomach the work.