code: public static MutableDoubleTuple replaceNaN(
          DoubleTuple t, double newValue, MutableDoubleTuple result)
      {
          return DoubleTupleFunctions.apply(
              t, d -> Double.isNaN(d) ? newValue : d, result);
      }
docs: Replace all occurrences of "Not A Number" in the given tuple
  with the given value, and store the result in the given
  result tuple
  
  @param t The tuple
  @param newValue The value that should replace the NaN value
  @param result The tuple that will store the result
  @return The result tuple
  @throws IllegalArgumentException If the given tuples do not
  have the same {@link Tuple#getSize() size}