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 69250
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) 1998 Ross Ihaka
3
 *  Copyright (C) 1998 Ross Ihaka
4
 *  Copyright (C) 2000-2002 The R Core Team
4
 *  Copyright (C) 2000-2015 The R Core Team
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
9
 *  (at your option) any later version.
Line 36... Line 36...
36
 
36
 
37
    if (x <= 0.)
37
    if (x <= 0.)
38
	return R_DT_0;
38
	return R_DT_0;
39
    /* same as weibull( shape = 1): */
39
    /* same as weibull( shape = 1): */
40
    x = -(x / scale);
40
    x = -(x / scale);
41
    if (lower_tail)
41
    return lower_tail
42
	return (log_p
-
 
43
		/* log(1 - exp(x))  for x < 0 : */
-
 
44
		? (x > -M_LN2 ? log(-expm1(x)) : log1p(-exp(x)))
42
	? (log_p ? R_Log1_Exp(x) : -expm1(x))
45
		: -expm1(x));
43
	: R_D_exp(x);
46
    /* else:  !lower_tail */
-
 
47
    return R_D_exp(x);
-
 
48
}
44
}