changeset 17928:079da800451b

Fix loading complex values with 'NA' saved in text format (bug #40575). * lo-utils.cc (read_inf_nan_na): Use is.putback to put back the character that was checked to see if it was 'N' for "NaN" rather than "NA".
author Rik <rik@octave.org>
date Thu, 14 Nov 2013 10:01:57 -0800
parents c17f06b50ac5
children 97bde75d4119
files liboctave/util/lo-utils.cc
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/lo-utils.cc	Thu Nov 14 09:45:17 2013 -0800
+++ b/liboctave/util/lo-utils.cc	Thu Nov 14 10:01:57 2013 -0800
@@ -202,8 +202,7 @@
   return retval;
 }
 
-// Note that the caller is responsible for repositioning the stream on
-// failure.
+// Note that the caller is responsible for repositioning the stream on failure.
 
 template <typename T>
 T
@@ -238,7 +237,10 @@
             if (c2 == 'n' || c2 == 'N')
               val = std::numeric_limits<T>::quiet_NaN ();
             else
-              val = octave_numeric_limits<T>::NA ();
+              {
+                val = octave_numeric_limits<T>::NA ();
+                is.putback (c2);
+              }
           }
         else
           is.setstate (std::ios::failbit);