diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index 4c5d77204eeb8bbfb707e463dd3bc13635c6118d..9adfcbdb9300ae88242f31118e79d6cfc9088f66 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -528,16 +528,19 @@ class CMathCallable(ScalarCallable): dtype)) if name in ["abs", "real", "imag"]: - dtype = real_dtype + result_dtype = real_dtype + else: + result_dtype = dtype - if dtype.kind == "c" or name in ["real", "imag", "abs"]: + if dtype.kind == "c": if name != "conj": name = "c" + name return ( self.copy(name_in_target=name, - arg_id_to_dtype={0: NumpyType(dtype), -1: - NumpyType(dtype)}), + arg_id_to_dtype={ + 0: NumpyType(dtype), + -1: NumpyType(result_dtype)}), callables_table) # binary functions