add similar NaN testing framework
expanded NaN testing framework to handle 3 variables
updated nan testing framework to check gradients of nan functions up to third order
updated nan testing framework for fvar<fvar<double> > and fvar<fvar<var> >
updated fvar so if value is nan, then deriv is set to nan too