summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorTorsten Paul <Torsten.Paul@gmx.de>2014-01-23 20:19:15 (GMT)
committerTorsten Paul <Torsten.Paul@gmx.de>2014-01-24 19:52:04 (GMT)
commit1212e2ba7c4d3b3ea20ecf91f716b18f3d1109e0 (patch)
tree5b8ede31e5c38971db44c8796aacecaefe55afff /src/value.cc
parent9d55e33b36d8b7fa802ebf6e962375828b05913d (diff)
Handle NaN / +Inf / -Inf in range evaluation (fixes #606).
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/value.cc b/src/value.cc
index c8a88c6..3a6540f 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -39,6 +39,10 @@
/*Unicode support for string lengths and array accesses*/
#include <glib.h>
+#include <boost/math/special_functions/fpclassify.hpp>
+using boost::math::isnan;
+using boost::math::isinf;
+
std::ostream &operator<<(std::ostream &stream, const Filename &filename)
{
fs::path fnpath = fs::path( (std::string)filename );
@@ -642,7 +646,11 @@ void Value::RangeType::normalize() {
}
uint32_t Value::RangeType::nbsteps() const {
- if (begin_val == end_val) {
+ if (isnan(step_val) || isinf(begin_val) || (isinf(end_val))) {
+ return std::numeric_limits<uint32_t>::max();
+ }
+
+ if ((begin_val == end_val) || isinf(step_val)) {
return 0;
}
contact: Jan Huwald // Impressum