Oh dear. I have just been a complete idiot, and failed to spot a little bit of code that was setting my lat/long to integers before I even got into the trigonometry. I feel very stupid....
At least it means that my code is correct, so I'll post it here in case it helps someone else:
'calculate distance in miles between two coordinates
Function DistanceBetweenPoints(iLat1, iLong1, iLat2, iLong2)
Dim iDistance
'first assume that the earth is spherical (ha ha)
iDistance = ACos( ( Sin(ToRad(iLat1)) * Sin(ToRad(iLat2)) ) + ( Cos(ToRad(iLat1)) * Cos(ToRad(iLat2)) * Cos(ToRad(iLong2) - ToRad(iLong1)) ) ) * 3959 'mean radius of earth in miles
DistanceBetweenPoints = CInt(iDistance) 'round up to lose decimal place
End Function
'ASP doesnt have these two trigonometric functions, or pi, built in (needed above)
Const PI = 3.141592653589793100 'use this value from SQL
Function ToRad(iDegrees)
ToRad = CDbl(iDegrees) * PI / 180
End Function
Function ACos(x)
If x = 1 Then
ACos = 0
ElseIf x= -1 Then
Acos = PI
Else
ACos = ATn(-x / Sqr(-x * x + 1)) + 2 * ATn(1)
End If
End Function