Fix fmin/fmax() when using Jets with float as their scalar type
Change-Id: Ie7f400763f91b0e264a50401716321587ab1d477
diff --git a/include/ceres/jet.h b/include/ceres/jet.h
index 90f916c..d6b8688 100644
--- a/include/ceres/jet.h
+++ b/include/ceres/jet.h
@@ -800,7 +800,7 @@
#if defined(CERES_HAS_CPP20)
return midpoint(J{x}, J{y});
#else
- return (J{x} + J{y}) * 0.5;
+ return (J{x} + J{y}) * typename J::Scalar(0.5);
#endif // defined(CERES_HAS_CPP20)
}
@@ -823,7 +823,7 @@
#if defined(CERES_HAS_CPP20)
return midpoint(J{x}, J{y});
#else
- return (J{x} + J{y}) * 0.5;
+ return (J{x} + J{y}) * typename J::Scalar(0.5);
#endif // defined(CERES_HAS_CPP20)
}