Fixed std::isfinite compilation error on OS X.
Merge branch 'next' into sam_2739
Merge branch 'sam_2739' into next