Skip to content
Snippets Groups Projects
Commit b263d752 authored by Richard Angersbach's avatar Richard Angersbach
Browse files

Add functions for numeric limits (to be supported by the backends)

parent fae371d4
Branches
1 merge request!438Reduction Support
......@@ -94,6 +94,16 @@ class MathFunctions(Enum):
self.num_args = num_args
class NumericLimitsFunctions(MathFunctions):
"""Numerical limits functions supported by the backend.
Each platform has to materialize these functions to a concrete implementation.
"""
min = ("min", 0)
max = ("max", 0)
class PsMathFunction(PsFunction):
"""Homogenously typed mathematical functions."""
......
......@@ -43,7 +43,7 @@ class GenericCpu(Platform):
@property
def required_headers(self) -> set[str]:
return {"<math.h>"}
return {"<math.h>", "<climits.h"}
def materialize_iteration_space(
self, body: PsBlock, ispace: IterationSpace
......@@ -62,6 +62,8 @@ class GenericCpu(Platform):
dtype = call.get_dtype()
arg_types = (dtype,) * func.num_args
# TODO: numeric limits
if isinstance(dtype, PsIeeeFloatType) and dtype.width in (32, 64):
cfunc: CFunction
match func:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment