diff options
author | Sergey Cherkashin <4erkashin@list.ru> | 2017-10-03 15:26:34 +0300 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2017-11-03 20:23:10 +0100 |
commit | ea38f4d89c9698895b1cf53a5946429dc1d8bbaa (patch) | |
tree | e05828ca1fedf55f104b837bc9c44215c2978e99 /include/math.h | |
parent | 68de9946e914d8c30dcc6667a059ea59e5b74cac (diff) |
math: add exception handling functionality
According to standards SVID and SYSV.
Modified lgamma calling in case when 'signgam' variable should not be used.
Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
Diffstat (limited to 'include/math.h')
-rw-r--r-- | include/math.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/include/math.h b/include/math.h index 25454764a..70f04f230 100644 --- a/include/math.h +++ b/include/math.h @@ -192,6 +192,30 @@ extern long double __REDIRECT_NTH (nexttowardl, (long double __x, long double __ #if defined __USE_MISC || defined __USE_XOPEN /* This variable is used by `gamma' and `lgamma'. */ extern int signgam; +#else +/* This is used when standart of libm + * should prevent lgamma(x) of modifying signgam variable. + */ +# define lgammaf(arg) \ +({ \ +int local_signgam = 0; \ +float result = lgammaf_r((float)arg, &local_signgam); \ +result; \ +}) + +# define lgamma(arg) \ +({ \ +int local_signgam = 0; \ +double result = lgamma_r(arg, &local_signgam); \ +result; \ +}) + +# define lgammal(arg) \ +({ \ +int local_signgam = 0; \ +long double result = lgammal_r(arg, &local_signgam); \ +result; \ +}) #endif @@ -361,7 +385,7 @@ struct exception # ifdef __cplusplus extern int matherr (struct __exception *__exc) throw (); # else -extern int matherr (struct exception *__exc); +extern int __attribute__ ((weak)) matherr (struct exception *__exc); # endif # define X_TLOSS 1.41484755040568800000e+16 |