I am trying to get two points, A and B, that are each in 5km distance horizontaly and verticaly around a center point C. Thus points A and B create a "box" with a side-length of 10km and C is in the exact center of this box. This is my code:

```
//Distance is 5 kilometers
float distance = 5;
float latCenter = locationInfo.lastLat;
float lngCenter = locationInfo.lastLong;
// Calculate corner point distance in lat and long
float latDelta = distance/110.54f;
float longDelta = distance/(111.320f(float)Math.cos((double)latCenter));
// Calculate coordinates of the corner points
float latA = lat - latDelta;
float longA = lng - longDelta;
float latB = lat + latDelta;
float longB = lng + longDelta;
```

I know these are approximations, but approximating with a margin of error of ~1km is fine in my case. The vertical distance is fine (10.06km) but the horizontal distance is only about 6km instead of 10km.

What is wrong with my formula? I guess its some very simple math error, but I just can't find it. I needed a very simple and quick code, so I based my calculations on this StackOverflow answer: Simple calculations for working with lat/lon + km distance?