You want to do it for all types T,
but you still want to return what
numeric_limits<double> returns.
All the types T you'll implement it for
will have implicit constructors T(double)
that will build the appropriate type out
of doubles.
At the very least, we'll need the following
for RM-HMC in Stan:
fvar<double>
fvar<var>
fvar<fvar<double>>
fvar<fvar<var>>
But they can all be implemented with one template.
And templating will also let client code plug in
float instead of double or some other base scalar
type.
- Bob