To calculate the overall number of positions in a given ending, you place kings first, then pawns (if any), then the remaining pieces.

In the case of krppkrp :

There are 1806 different positions of kings (taking a vertical symmetry into account) among which 106 leave 48 free squares for pawns (both kings on 1st/8th ranks), 724 leave 47 (1 king on 1st/8th ranks) and 976 leave 46 (no king on 1st/8th ranks).

This gives (106*48*47*46+724*47*46*45+976*46*45*44)/2=85166148 positions for kings+pawns (divide by 2 because the two white pawns are interchangeable).

Then place the rooks on the 59 remaining squares : 59*58=3422 possibilities.

Total = 85166148*3422*2 (multiply by 2 for white to move/black to move) = 582877116912 positions.

Positions recorded have the following characteristics :

- kings are never adjacent to each other

- pawns are always on legal squares (no pawn on 1st/8th rank)

- however many positions are illegal since the side not to move is in check (but these are impossible to enumerate with a simple formula, of course)

- positions with castling or en passant possibilities are not taken into account (also not so easy to enumerate, they represent only a very small percentage)

Here is a file containing combinatorial calculations for all 3-8 men endings (I didn't expect to release it so it doesn't have many comments - if something is unclear please let me know)

To translate Gpos into Gb for file size expectations, you can use the following rules (occasionnally very wrong but not so bad in the majority of cases and more accurate for global sets) : 4 pos/byte in DTM, 7 pos/byte in DTC, 8 pos/byte in DTZ or DTZ50, 50 pos/byte in WDL.