Skip to main content
Use HINCRBYFLOAT to add a floating point number to the value of a hash field and get the result. The stored value and the increment are parsed as double precision floats, and a missing field or key counts as 0. The increment may be negative, and there is no separate decrement command. A value that is not a valid number returns an error. The reply is the new value as a string, which client libraries usually decode into a native number. Note that the result is stored in the same textual form, so repeated increments of values that cannot be represented exactly in binary floating point accumulate the usual rounding error; keep money and similar quantities in integer units and use HINCRBY.

Syntax

Arguments

Important points

  • The value is always returned as a bulk string, in both RESP2 and RESP3. Client libraries commonly decode it to a language number.

Response

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

Related topics

HINCRBYFLOATOverview