The R Project SVN R

Rev

Rev 68947 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68947 Rev 75839
Line 1... Line 1...
1
/*
1
/*
2
 *  Mathlib : A C Library of Special Functions
2
 *  Mathlib : A C Library of Special Functions
-
 
3
 *  Copyright (C) 2000-2018 The R Core Team
-
 
4
 *  Copyright (C) 2002-2018 The R Foundation
3
 *  Copyright (C) 1998 Ross Ihaka
5
 *  Copyright (C) 1998 Ross Ihaka
4
 *  Copyright (C) 2000-2013 The R Core Team
-
 
5
 *  Copyright (C) 2002-2004 The R Foundation
-
 
6
 *
6
 *
7
 *  This program is free software; you can redistribute it and/or modify
7
 *  This program is free software; you can redistribute it and/or modify
8
 *  it under the terms of the GNU General Public License as published by
8
 *  it under the terms of the GNU General Public License as published by
9
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  (at your option) any later version.
10
 *  (at your option) any later version.
Line 180... Line 180...
180
    }
180
    }
181
    else {
181
    else {
182
	/* gamma(x) for	 y = |x| > 10. */
182
	/* gamma(x) for	 y = |x| > 10. */
183
 
183
 
184
	if (x > xmax) {			/* Overflow */
184
	if (x > xmax) {			/* Overflow */
185
	    ML_ERROR(ME_RANGE, "gammafn");
185
	    // No warning: +Inf is the best answer
186
	    return ML_POSINF;
186
	    return ML_POSINF;
187
	}
187
	}
188
 
188
 
189
	if (x < xmin) {			/* Underflow */
189
	if (x < xmin) {			/* Underflow */
190
	    ML_ERROR(ME_UNDERFLOW, "gammafn");
190
	    // No warning: 0 is the best answer
191
	    return 0.;
191
	    return 0.;
192
	}
192
	}
193
 
193
 
194
	if(y <= 50 && y == (int)y) { /* compute (n - 1)! */
194
	if(y <= 50 && y == (int)y) { /* compute (n - 1)! */
195
	    value = 1.;
195
	    value = 1.;