1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:57:35 +00:00

LibC: Add barebones <complex.h>

This commit is contained in:
Peter Elliott 2022-05-07 12:17:04 -06:00 committed by Andreas Kling
parent 8a007e755d
commit 3f0be4e9ea
3 changed files with 91 additions and 0 deletions

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2022, Peter Elliott <pelliott@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <complex.h>
extern "C" {
// Function definitions of this form "type (name)(args)" are intentional, to
// prevent macro versions of "name" from being incorrectly expanded. These
// functions are here to provide external linkage to their macro implementations.
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/creal.html
float(crealf)(float complex z)
{
return crealf(z);
}
double(creal)(double complex z)
{
return creal(z);
}
long double(creall)(long double complex z)
{
return creall(z);
}
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/cimag.html
double(cimag)(double complex z)
{
return cimag(z);
}
float(cimagf)(float complex z)
{
return cimagf(z);
}
long double(cimagl)(long double complex z)
{
return cimagl(z);
}
}