--- gtk/src/treeview.orig	2016-04-15 12:19:55.268312900 +0300
+++ gtk/src/treeview.hg	2016-04-15 13:04:59.894921600 +0300
@@ -71,6 +71,9 @@
 
   template <class ColumnType> inline
   void _auto_cell_data_func(Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter, int model_column, const Glib::ustring& format);
+
+  template<class ColumnType> inline
+  ColumnType _numeric_cast(const Glib::ustring& text);
 }
 
 #endif //DOXYGEN_SHOULD_SKIP_THIS
@@ -1185,19 +1188,11 @@
       //new_value << astream; //Get it out of the stream as the numerical type.
 
       //Convert the text to a number, using the same logic used by GtkCellRendererText when it stores numbers.
-      ColumnType new_value = ColumnType();
-      try
-      {
-        new_value =  static_cast<ColumnType>( std::stod(new_text) );
-      } catch(const std::invalid_argument&)
-      {
-         //Intentionally ignored.
-         //Applications can use their own logic if they want to handle invalid input differently.
-      }
+      ColumnType new_value = _numeric_cast<ColumnType>(new_text);
 
       //Store the user's new text in the model:
       Gtk::TreeRow row = *iter;
-      row.set_value(model_column, (ColumnType)new_value);
+      row.set_value(model_column, new_value);
     }
   }
 }
@@ -1231,6 +1226,46 @@
   }
 }
 
+
+template<class T>
+struct NumericCastFunc // Default falls back to strtod
+{
+  static T apply(const Glib::ustring& text)
+  {
+    return strtod(text.c_str(), nullptr);
+  }
+};
+
+// Specializations for other numeric types
+#define GTKMM_TREEVIEW_NUMERIC_CAST_SPECIALIZATION(T, Func, ...) \
+template<> \
+struct NumericCastFunc<T> \
+{ \
+  static T apply(const Glib::ustring& text) \
+  { \
+    return Func(text.c_str(), __VA_ARGS__); \
+  } \
+}; \
+/**/
+
+// Floating point
+GTKMM_TREEVIEW_NUMERIC_CAST_SPECIALIZATION(float, strtof, nullptr)
+GTKMM_TREEVIEW_NUMERIC_CAST_SPECIALIZATION(long double, strtold, nullptr)
+
+// Cardinal
+GTKMM_TREEVIEW_NUMERIC_CAST_SPECIALIZATION(long int, strtol, nullptr, 0)
+GTKMM_TREEVIEW_NUMERIC_CAST_SPECIALIZATION(unsigned long int, strtoul, nullptr, 0)
+GTKMM_TREEVIEW_NUMERIC_CAST_SPECIALIZATION(long long int, strtoll, nullptr, 0)
+GTKMM_TREEVIEW_NUMERIC_CAST_SPECIALIZATION(unsigned long long int, strtoull, nullptr, 0)
+
+#undef GTKMM_TREEVIEW_NUMERIC_CAST_SPECIALIZATION
+
+template<class ColumnType> inline
+ColumnType _numeric_cast(const Glib::ustring& text)
+{
+  return NumericCastFunc<ColumnType>::apply(text);
+}
+
 } // namespace TreeView_Private
 #endif //DOXYGEN_SHOULD_SKIP_THIS
 
