Fix incorrect limits in FloatOptionStorage
authorTeemu Murtola <teemu.murtola@gmail.com>
Thu, 1 May 2014 18:20:22 +0000 (21:20 +0300)
committerTeemu Murtola <teemu.murtola@gmail.com>
Thu, 1 May 2014 18:20:22 +0000 (21:20 +0300)
This typo didn't cause any problems in Gromacs, since currently, no code
path enters here.  But if user code would use FloatOption or RealOption,
it would trigger.  Found while taking this code into actual use in
master.

Change-Id: I712faf365359964f6f767991664da7981072e5bd

src/gromacs/options/basicoptions.cpp

index 1d1a5f1a74d034b8c3e27d050f4103870bca5a7f..f1af57aa32bed7ea3c075503fbfb457b610b6b42 100644 (file)
@@ -376,7 +376,7 @@ void FloatOptionStorage::convertValue(const std::string &value)
     double      dval = std::strtod(ptr, &endptr);
     if (errno == ERANGE
         || dval * factor_ < -std::numeric_limits<float>::max()
-        || dval * factor_ > -std::numeric_limits<float>::max())
+        || dval * factor_ >  std::numeric_limits<float>::max())
     {
         GMX_THROW(InvalidInputError("Invalid value: '" + value
                                     + "'; it causes an overflow/underflow"));