-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libroot: added a complex.h header based on ...
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/complex.h.html * added missing parts from glibc. * x86_64 was already complete, x86 was missing a few functions. * should help with #12202, provided that the gcc4 buildtools are rebuilt.
- Loading branch information
Showing
23 changed files
with
1,218 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* Copyright 2015 Haiku, Inc. All Rights Reserved. | ||
* Distributed under the terms of the MIT License. | ||
*/ | ||
#ifndef _COMPLEX_H_ | ||
#define _COMPLEX_H_ | ||
|
||
#ifdef __GNUC__ | ||
# if __STDC_VERSION__ < 199901L | ||
# define _Complex __complex__ | ||
#endif | ||
#define _Complex_I ((float _Complex)1.0i) | ||
#endif | ||
|
||
#define complex _Complex | ||
#define I _Complex_I | ||
|
||
extern double cabs(double complex); | ||
extern float cabsf(float complex); | ||
extern long double cabsl(long double complex); | ||
extern double complex cacos(double complex); | ||
extern float complex cacosf(float complex); | ||
extern double complex cacosh(double complex); | ||
extern float complex cacoshf(float complex); | ||
extern long double complex cacoshl(long double complex); | ||
extern long double complex cacosl(long double complex); | ||
extern double carg(double complex); | ||
extern float cargf(float complex); | ||
extern long double cargl(long double complex); | ||
extern double complex casin(double complex); | ||
extern float complex casinf(float complex); | ||
extern double complex casinh(double complex); | ||
extern float complex casinhf(float complex); | ||
extern long double complex casinhl(long double complex); | ||
extern long double complex casinl(long double complex); | ||
extern double complex catan(double complex); | ||
extern float complex catanf(float complex); | ||
extern double complex catanh(double complex); | ||
extern float complex catanhf(float complex); | ||
extern long double complex catanhl(long double complex); | ||
extern long double complex catanl(long double complex); | ||
extern double complex ccos(double complex); | ||
extern float complex ccosf(float complex); | ||
extern double complex ccosh(double complex); | ||
extern float complex ccoshf(float complex); | ||
extern long double complex ccoshl(long double complex); | ||
extern long double complex ccosl(long double complex); | ||
extern double complex cexp(double complex); | ||
extern float complex cexpf(float complex); | ||
extern long double complex cexpl(long double complex); | ||
extern double cimag(double complex); | ||
extern float cimagf(float complex); | ||
extern long double cimagl(long double complex); | ||
extern double complex clog(double complex); | ||
extern float complex clogf(float complex); | ||
extern long double complex clogl(long double complex); | ||
extern double complex conj(double complex); | ||
extern float complex conjf(float complex); | ||
extern long double complex conjl(long double complex); | ||
extern double complex cpow(double complex, double complex); | ||
extern float complex cpowf(float complex, float complex); | ||
extern long double complex cpowl(long double complex, long double complex); | ||
extern double complex cproj(double complex); | ||
extern float complex cprojf(float complex); | ||
extern long double complex cprojl(long double complex); | ||
extern double creal(double complex); | ||
extern float crealf(float complex); | ||
extern long double creall(long double complex); | ||
extern double complex csin(double complex); | ||
extern float complex csinf(float complex); | ||
extern double complex csinh(double complex); | ||
extern float complex csinhf(float complex); | ||
extern long double complex csinhl(long double complex); | ||
extern long double complex csinl(long double complex); | ||
extern double complex csqrt(double complex); | ||
extern float complex csqrtf(float complex); | ||
extern long double complex csqrtl(long double complex); | ||
extern double complex ctan(double complex); | ||
extern float complex ctanf(float complex); | ||
extern double complex ctanh(double complex); | ||
extern float complex ctanhf(float complex); | ||
extern long double complex ctanhl(long double complex); | ||
extern long double complex ctanl(long double complex); | ||
|
||
#endif /* _COMPLEX_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
SubDir HAIKU_TOP src system libroot posix glibc math ; | ||
|
||
SubDirCcFlags -D_GNU_SOURCE -DUSE_IN_LIBIO ; | ||
|
||
local architectureObject ; | ||
for architectureObject in [ MultiArchSubDirSetup ] { | ||
on $(architectureObject) { | ||
local architecture = $(TARGET_PACKAGING_ARCH) ; | ||
|
||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch | ||
$(TARGET_ARCH) ; | ||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include arch | ||
generic ; | ||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc include ; | ||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc math ; | ||
SubDirSysHdrs $(HAIKU_TOP) src system libroot posix glibc ; | ||
|
||
UsePrivateHeaders libroot ; | ||
|
||
MergeObject <$(architecture)>posix_gnu_math.o : | ||
cabs.c cabsf.c cabsl.c | ||
carg.c cargf.c cargl.c | ||
cimag.c cimagf.c cimagl.c | ||
conj.c conjf.c conjl.c | ||
creal.c crealf.c creall.c | ||
|
||
k_casinh.c k_casinhf.c k_casinhl.c | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* Return the complex absolute value of double complex value. | ||
Copyright (C) 1997-2015 Free Software Foundation, Inc. | ||
This file is part of the GNU C Library. | ||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. | ||
The GNU C Library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
The GNU C Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with the GNU C Library; if not, see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#include <complex.h> | ||
#include <math.h> | ||
|
||
double | ||
__cabs (double _Complex z) | ||
{ | ||
return __hypot (__real__ z, __imag__ z); | ||
} | ||
weak_alias (__cabs, cabs) | ||
#ifdef NO_LONG_DOUBLE | ||
strong_alias (__cabs, __cabsl) | ||
weak_alias (__cabs, cabsl) | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Return the complex absolute value of float complex value. | ||
Copyright (C) 1997-2015 Free Software Foundation, Inc. | ||
This file is part of the GNU C Library. | ||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. | ||
The GNU C Library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
The GNU C Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with the GNU C Library; if not, see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#include <complex.h> | ||
#include <math.h> | ||
|
||
float | ||
__cabsf (float _Complex z) | ||
{ | ||
return __hypotf (__real__ z, __imag__ z); | ||
} | ||
weak_alias (__cabsf, cabsf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Return the complex absolute value of long double complex value. | ||
Copyright (C) 1997-2015 Free Software Foundation, Inc. | ||
This file is part of the GNU C Library. | ||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. | ||
The GNU C Library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
The GNU C Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with the GNU C Library; if not, see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#include <complex.h> | ||
#include <math.h> | ||
|
||
long double | ||
__cabsl (long double _Complex z) | ||
{ | ||
return __hypotl (__real__ z, __imag__ z); | ||
} | ||
weak_alias (__cabsl, cabsl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* Compute argument of complex double value. | ||
Copyright (C) 1997-2015 Free Software Foundation, Inc. | ||
This file is part of the GNU C Library. | ||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. | ||
The GNU C Library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
The GNU C Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with the GNU C Library; if not, see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#include <complex.h> | ||
#include <math.h> | ||
|
||
double | ||
__carg (__complex__ double x) | ||
{ | ||
return __atan2 (__imag__ x, __real__ x); | ||
} | ||
weak_alias (__carg, carg) | ||
#ifdef NO_LONG_DOUBLE | ||
strong_alias (__carg, __cargl) | ||
weak_alias (__carg, cargl) | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Compute argument of complex float value. | ||
Copyright (C) 1997-2015 Free Software Foundation, Inc. | ||
This file is part of the GNU C Library. | ||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. | ||
The GNU C Library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
The GNU C Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with the GNU C Library; if not, see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#include <complex.h> | ||
#include <math.h> | ||
|
||
float | ||
__cargf (__complex__ float x) | ||
{ | ||
return __atan2f (__imag__ x, __real__ x); | ||
} | ||
weak_alias (__cargf, cargf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* Compute argument of complex long double value. | ||
Copyright (C) 1997-2015 Free Software Foundation, Inc. | ||
This file is part of the GNU C Library. | ||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. | ||
The GNU C Library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
The GNU C Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with the GNU C Library; if not, see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#include <complex.h> | ||
#include <math.h> | ||
|
||
long double | ||
__cargl (__complex__ long double x) | ||
{ | ||
return __atan2l (__imag__ x, __real__ x); | ||
} | ||
weak_alias (__cargl, cargl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* Return imaginary part of complex double value. | ||
Copyright (C) 1997-2015 Free Software Foundation, Inc. | ||
This file is part of the GNU C Library. | ||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. | ||
The GNU C Library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
License as published by the Free Software Foundation; either | ||
version 2.1 of the License, or (at your option) any later version. | ||
The GNU C Library is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Lesser General Public License for more details. | ||
You should have received a copy of the GNU Lesser General Public | ||
License along with the GNU C Library; if not, see | ||
<http://www.gnu.org/licenses/>. */ | ||
|
||
#include <complex.h> | ||
|
||
double | ||
__cimag (double _Complex z) | ||
{ | ||
return __imag__ z; | ||
} | ||
weak_alias (__cimag, cimag) | ||
#ifdef NO_LONG_DOUBLE | ||
strong_alias (__cimag, __cimagl) | ||
weak_alias (__cimag, cimagl) | ||
#endif |
Oops, something went wrong.