diff --git a/library/math_tgamma.c b/library/math_tgamma.c index a8c086c..ae46944 100644 --- a/library/math_tgamma.c +++ b/library/math_tgamma.c @@ -1,10 +1,8 @@ /* - * $Id: math_tgamma.c,v 1.3 2006-01-08 12:04:24 obarthel Exp $ - * * :ts=4 * * Portable ISO 'C' (1994) runtime library for the Amiga computer - * Copyright (c) 2002-2015 by Olaf Barthel + * Copyright (c) 2002-2025 by Olaf Barthel * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,13 +52,11 @@ double tgamma(double x) { int gamma_sign; - double y; + double y; - y = __lgamma(x,&gamma_sign); - if (gamma_sign < 0) - y = -y; + y = __lgamma(x, &gamma_sign); - return y; + return gamma_sign * exp(y); } /****************************************************************************/ diff --git a/library/math_tgammaf.c b/library/math_tgammaf.c index 4da5c8e..a1da902 100644 --- a/library/math_tgammaf.c +++ b/library/math_tgammaf.c @@ -1,6 +1,4 @@ /* - * $Id: math_tgammaf.c,v 1.3 2006-01-08 12:04:24 obarthel Exp $ - * * :ts=4 * * Portable ISO 'C' (1994) runtime library for the Amiga computer @@ -56,11 +54,9 @@ tgammaf(float x) int gamma_sign; float y; - y = __lgammaf(x,&gamma_sign); - if (gamma_sign < 0) - y = -y; + y = __lgammaf(x, &gamma_sign); - return y; + return gamma_sign * expf(y); } /****************************************************************************/