1diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h
2index 51d79f9c2ec59..fafd7d6fc1e0d 100644
3--- a/modules/fdlibm/src/math_private.h
4+++ b/modules/fdlibm/src/math_private.h
5@@ -30,5 +30,9 @@
6 * Adapted from https://github.com/freebsd/freebsd-src/search?q=__double_t
7 */
8
9+#if defined __FLT_EVAL_METHOD__ && (__FLT_EVAL_METHOD__ == 2)
10+typedef long double __double_t;
11+#else
12 typedef double __double_t;
13+#endif
14 typedef __double_t double_t;
15
16 /*