mapnik::value - return 'infinity' if rhs == 0 to avoid division by zero
This commit is contained in:
parent
911993512a
commit
8c03ea3d68
1 changed files with 3 additions and 0 deletions
|
@ -495,6 +495,7 @@ struct div: public boost::static_visitor<V>
|
||||||
template <typename T>
|
template <typename T>
|
||||||
value_type operator() (T lhs, T rhs) const
|
value_type operator() (T lhs, T rhs) const
|
||||||
{
|
{
|
||||||
|
if (rhs == 0) return std::numeric_limits<value_type>::infinity();
|
||||||
return lhs / rhs;
|
return lhs / rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,11 +514,13 @@ struct div: public boost::static_visitor<V>
|
||||||
|
|
||||||
value_type operator() (value_double lhs, value_integer rhs) const
|
value_type operator() (value_double lhs, value_integer rhs) const
|
||||||
{
|
{
|
||||||
|
if (rhs == 0) return std::numeric_limits<value_type>::infinity();
|
||||||
return lhs / rhs;
|
return lhs / rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
value_type operator() (value_integer lhs, value_double rhs) const
|
value_type operator() (value_integer lhs, value_double rhs) const
|
||||||
{
|
{
|
||||||
|
if (rhs == 0) return std::numeric_limits<value_type>::infinity();
|
||||||
return lhs / rhs;
|
return lhs / rhs;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue