diff --git a/commands.go b/commands.go index 0375b2d6..6ba174e3 100644 --- a/commands.go +++ b/commands.go @@ -5,7 +5,7 @@ import ( ) func formatFloat(f float64) string { - return strconv.FormatFloat(f, 'f', -1, 32) + return strconv.FormatFloat(f, 'f', -1, 64) } //------------------------------------------------------------------------------ diff --git a/redis_test.go b/redis_test.go index 6102b073..2d611a1a 100644 --- a/redis_test.go +++ b/redis_test.go @@ -953,6 +953,12 @@ func (t *RedisTest) TestIncrByFloat(c *C) { c.Assert(incrByFloat.Val(), Equals, float64(5200)) } +func (t *RedisTest) TestIncrByFloatOverflow(c *C) { + incrByFloat := t.client.IncrByFloat("key", 996945661) + c.Assert(incrByFloat.Err(), IsNil) + c.Assert(incrByFloat.Val(), Equals, float64(996945661)) +} + func (t *RedisTest) TestStringsMSetMGet(c *C) { mSet := t.client.MSet("key1", "hello1", "key2", "hello2") c.Assert(mSet.Err(), IsNil)