Handle "inf" as well as "+inf"

Redis (v2.8 and v3) returns "inf" for positive infinity values, but here a "+inf" is expected. So changed the code to work with both: "+inf" as well as "inf".
See Issue #287: https://github.com/StackExchange/StackExchange.Redis/issues/287
parent 8e6c8c0d
...@@ -144,7 +144,7 @@ internal static bool TryParseDouble(string s, out double value) ...@@ -144,7 +144,7 @@ internal static bool TryParseDouble(string s, out double value)
return true; return true;
} }
// need to handle these // need to handle these
if(string.Equals("+inf", s, StringComparison.OrdinalIgnoreCase)) if(string.Equals("+inf", s, StringComparison.OrdinalIgnoreCase) || string.Equals("inf", s, StringComparison.OrdinalIgnoreCase))
{ {
value = double.PositiveInfinity; value = double.PositiveInfinity;
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment