MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / addReplyDoubleDistance

Function addReplyDoubleDistance

src/geo.cpp:206–210  ·  view source on GitHub ↗

The default addReplyDouble has too much accuracy. We use this * for returning location distances. "5.2145 meters away" is nicer * than "5.2144992818115 meters away." We provide 4 digits after the dot * so that the returned value is decently accurate even when the unit is * the kilometer. */

Source from the content-addressed store, hash-verified

204 * so that the returned value is decently accurate even when the unit is
205 * the kilometer. */
206void addReplyDoubleDistance(client *c, double d) {
207 char dbuf[128];
208 int dlen = snprintf(dbuf, sizeof(dbuf), "%.4f", d);
209 addReplyBulkCBuffer(c, dbuf, dlen);
210}
211
212/* Helper function for geoGetPointsInRange(): given a sorted set score
213 * representing a point, and a GeoShape, appends this entry as a geoPoint

Callers 2

georadiusGenericFunction · 0.85
geodistCommandFunction · 0.85

Calls 1

addReplyBulkCBufferFunction · 0.85

Tested by

no test coverage detected