ze-filter  (ze-filter-0.8.0-develop-180218)
ze-logit.c
Go to the documentation of this file.
1 /*
2  *
3  * ze-filter - Mail Server Filter for sendmail
4  *
5  * Copyright (c) 2001-2018 - Jose-Marcio Martins da Cruz
6  *
7  * Auteur : Jose Marcio Martins da Cruz
8  * jose.marcio.mc@gmail.org
9  *
10  * Historique :
11  * Creation : Wed Aug 15 15:27:48 CEST 2007
12  *
13  * This program is free software, but with restricted license :
14  *
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  *
20  * More details about ze-filter license can be found at ze-filter
21  * web site : http://foss.jose-marcio.org
22  */
23 
24 
25 #include <ze-sys.h>
26 #include <ze-filter.h>
27 #include <ze-logit.h>
28 
29 /* ****************************************************************************
30  * *
31  * *
32  **************************************************************************** */
33 double
35  double p;
36 {
37  if (p <= 0.)
38  return 0.;
39 
40  if (p >= 1.)
41  return 1.;
42  p += (p >= 0.5 ? -1e-10 : 1e-10);
43 
44  return log(p / (1. - p));
45 }
46 
47 /* ****************************************************************************
48  * *
49  * *
50  **************************************************************************** */
51 double
53  double p;
54 {
55  if (p <= 0.)
56  return 0;
57 
58  return log(p);
59 }
60 
61 /* ****************************************************************************
62  * *
63  * *
64  **************************************************************************** */
65 double
66 logit2(a, b)
67  int a;
68  int b;
69 {
70  return log((a + 0.5) / (b + 0.5));
71 }
72 
73 /* ****************************************************************************
74  * *
75  * *
76  **************************************************************************** */
77 double
79  double x;
80 {
81  return 1. / (1. + exp(-x));
82 }
double logit2(int a, int b)
Definition: ze-logit.c:66
double logitodd(double p)
Definition: ze-logit.c:52
double logitinv(double x)
Definition: ze-logit.c:78
double logit(double p)
Definition: ze-logit.c:34