Major/minor can be got from |v:version|.
If you want to know if a specific patch is compiled-in (let's say
8.0.256) you can test
if (version > 800) || (version == 800 && has('patch256'))
The above intentionally has more parentheses than is strictly
necessary, for the ease of the human reader.
Remember that patch presence/absence is conceptually not a number but
an array of booleans, and it may be quite a large array (for version
8.1 it has as of this writing 1330 bits and climbing): it is possible
for patch n to be compiled-in even if patch (n-1) isn't. AFAIK the
only way to get the full list of which patches are in and which ones
aren't, is to :redir the output of :version somewhere (e.g. to a
register) then to parse (if it exists) the line beginning "Included
patches:" which is near the top of that output. That line can be
absent if you got the initial release of that major/minor version with
no patches.
Best regards,
Tony.