Serenity Operating System
1/*
2 * Copyright (c) 2022, Peter Elliott <pelliott@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#include <complex.h>
8
9extern "C" {
10
11// Function definitions of this form "type (name)(args)" are intentional, to
12// prevent macro versions of "name" from being incorrectly expanded. These
13// functions are here to provide external linkage to their macro implementations.
14
15// https://pubs.opengroup.org/onlinepubs/9699919799/functions/creal.html
16float(crealf)(float complex z)
17{
18 return crealf(z);
19}
20
21double(creal)(double complex z)
22{
23 return creal(z);
24}
25
26long double(creall)(long double complex z)
27{
28 return creall(z);
29}
30
31// https://pubs.opengroup.org/onlinepubs/9699919799/functions/cimag.html
32double(cimag)(double complex z)
33{
34 return cimag(z);
35}
36
37float(cimagf)(float complex z)
38{
39 return cimagf(z);
40}
41
42long double(cimagl)(long double complex z)
43{
44 return cimagl(z);
45}
46}