To calculate the driving temperature difference between the hot and the cold side of a heat exchanger, the use of the logarithmic mean temperature difference is common practice. To provide high robustness in complex dynamic system models, a robust formulation of the logarithmic mean (logmean) function becomes vital. As the analytic definition of the logmean function naturally comes along with singularities and limitations for specific input conditions, it is essential to extend and modify it for heat exchanger modeling. This paper proposes how the logmean function can be extended to be valid in all four quadrants of the Cartesian coordinate system and how to bridge the resulting definition gaps. Special focus lies on the robust formulation in such a way that it can be easily handled by numerical solvers. This includes the numerical approximation of the logmean by use of its integral form by implicit ODE solvers with variable step width. Furthermore a way is presented to flatten the naturally steep gradients in the vicinity of the x- and y-axes without manipulating the function in the uncritical regions. All the modifications on the logmean are finally applied in a simple simulation model written in the object-oriented programming language Modelica to examine the robustness of the approach.