You can put this solution on YOUR website! if you are looking for the shortest distance between each of these, then i believe the table should look like this:
E NNE NE SE WNW
N 90 22.5 45 135 67.5
ENE 22.5 45 22.5 67.5 135
NW 135 67.5 90 180 22.5
WSW 157.5 135 157.5 112.5 45
SSW 112.5 180 157.5 67.5 90
in some cases you had the right distance, but it was the longer distance between them rather than the shorter distance.
the shorter distance always had to be less than 180.
i based my number on the following diagram:
each interval is equal to 22.5 degrees.
to calculate the distance between selected points, just count the number of dots
for the shortest distance between them to come up with the difference.
example:
WSW to ESE is 6 dots
6 * 22.5 = 135 degrees.
WSW is at 247.5 degrees
ESE is at 112.5 degrees
247,5 - 112.5 = 135 degrees.
another example:
NNW to NNE is 2 dots
2 * 12.5 = 45 degrees
337.5 - 22.5 = 315 degrees
this is actually the long way around because it is greater than 180 degrees.
to convert it to the shortest way around, subtract it from 360 degrees to get 45 degrees.
i saw only one distance where you actually calculated it wrong.
i believe that was SSW to SE.
you showed 247.5 and i calculated 67.5 the short way there and 292.5 the long way.
anyway, that's my view of it.
you can use the chart to double check your work as well.