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