1
0
mirror of https://github.com/redis/go-redis.git synced 2026-10-24 07:59:20 +03:00

1 Commits

Author SHA1 Message Date
Yingzi Zhang
372b420c56 fix(cmd): accept RESP3 doubles in Cmd.Float64 (#4088)
* fix(cmd): accept RESP3 doubles in Cmd.Float64

With RESP3, the default protocol, ReadReply returns a double reply
(for example from ZSCORE) as float64. toFloat64 and toFloat32 only
handled int64 and string, so Cmd.Float64, Float32, Float64Slice and
Float32Slice failed with "unexpected type=float64". Handle float64 the
same way toBool handles the RESP3 boolean.

* fix(cmd): keep Float32 range error on RESP3

float32(val) turns a RESP3 double outside the float32 range into an
infinity without an error, while the RESP2 bulk string path returns the
ParseFloat range error. Return the same error for the RESP3 double. An
infinity sent by the server is still returned as is.

---------

Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
2026-10-19 18:45:51 +03:00