diff --git a/src/pystencils/backend/platforms/generic_cpu.py b/src/pystencils/backend/platforms/generic_cpu.py
index 58b9c79463421d84af3654c84234450f5ce93cec..b145b6f76389fb75c5f94eafd3462cb084247b35 100644
--- a/src/pystencils/backend/platforms/generic_cpu.py
+++ b/src/pystencils/backend/platforms/generic_cpu.py
@@ -44,7 +44,7 @@ class GenericCpu(Platform):
 
     @property
     def required_headers(self) -> set[str]:
-        return {"<math.h>", "<limits.h>", "<float.h>"}
+        return {"<math.h>", "<limits>"}
 
     def materialize_iteration_space(
         self, body: PsBlock, ispace: IterationSpace
@@ -64,22 +64,7 @@ class GenericCpu(Platform):
         arg_types = (dtype,) * func.num_args
 
         if isinstance(dtype, PsScalarType) and func in (NumericLimitsFunctions.Min, NumericLimitsFunctions.Max):
-            # get type prefix for macro
-            # TODO: there must be a better way...
-            tpe = ""
-            match dtype:
-                case PsIeeeFloatType():
-                    match dtype.width:
-                        case 32:
-                            tpe = "FLT"
-                        case 64:
-                            tpe = "DBL"
-                case _:
-                    raise MaterializationError(
-                        f"No implementation available for function {func} on data type {dtype}"
-                    )
-
-            return PsLiteralExpr(PsLiteral(f"{tpe}_{func.function_name}".upper(), dtype))
+            return PsLiteralExpr(PsLiteral(f"std::numeric_limits<{dtype.c_string()}>::{func.function_name}()", dtype))
 
         if isinstance(dtype, PsIeeeFloatType) and dtype.width in (32, 64):
             cfunc: CFunction