Skip to main content
,

Double

RESP3

prefix: ,  ·  client type: float / double / Float64

RESP3 type – requires HELLO 3 at connection startup to activate. RESP2 clients will not receive this type.

RESP3 doubles carry IEEE 754 floating-point values natively. Format: ,<number>\r\n. Supports ,inf\r\n and ,-inf\r\n for infinity. Previously, Redis returned floats as bulk strings (e.g., ZSCORE returned '$4\r\n1.25\r\n'), requiring clients to parse the string. RESP3 doubles let clients receive native float/double values directly.

Details

RESP3 doubles have the format ,<floating-point>\r\n.

Valid forms: ,1.23\r\n – floating point ,10\r\n – integer value as double (,10 and :10 are different types) ,inf\r\n – positive infinity ,-inf\r\n – negative infinity ,nan\r\n – not a number (not commonly returned by Redis)

No exponent notation: the spec states exponential format is invalid. No leading dot: .5 is invalid; use 0.5.

In RESP2, ZSCORE returned a bulk string like $4\r\n1.25\r\n. Clients had to call float(reply) or parseFloat(reply) to get a number. In RESP3, ZSCORE returns ,1.25\r\n and the client receives a native float.

Commands that return doubles in RESP3: ZSCORE, ZADD (when used with the INCR option), ZINCRBY, geodist results.

Wire encoding

Wire bytes (CRLF shown as \\r\\n)
,1.25\r\n
,3.14159\r\n
,inf\r\n
,-inf\r\n
,0\r\n

Type information

Prefix byte,
VersionRESP3
Client typefloat / double / Float64
SpecificationRESP3 specification (GitHub) →

Redis commands returning this type

ZSCOREZINCRBYZADD (INCR mode)GEODIST

See Also