      static bool is_finite(const double val) {
#ifdef isfinite
        return (bool)isfinite(val);
#else
        return !is_nan(val) && !is_inf(val);
#endif
      }
      static bool is_finite(const double val) {
#ifdef isfinite
        return (bool)isfinite(val);
#else
        return !is_nan(val) && !is_inf(val);
#endif
      }