1 #ifndef EXPRESSIONS_HELPERS_H
2 #define EXPRESSIONS_HELPERS_H
6 #include <gsl/gsl_cdf.h>
7 #include <gsl/gsl_randist.h>
8 #include <gsl/gsl_sf.h>
13 #include <data/calendar.h>
14 #include <data/case.h>
15 #include <data/data-in.h>
16 #include <data/data-out.h>
17 #include <data/dictionary.h>
18 #include <data/procedure.h>
19 #include <data/settings.h>
20 #include <data/value.h>
21 #include <data/variable.h>
22 #include <data/vector.h>
23 #include <gsl-extras/gsl-extras.h>
24 #include <language/expressions/public.h>
25 #include <libpspp/compiler.h>
26 #include <libpspp/message.h>
27 #include <libpspp/misc.h>
28 #include <libpspp/str.h>
29 #include <math/moments.h>
30 #include <math/random.h>
33 #define _(msgid) gettext (msgid)
35 static inline double check_errno (double x)
37 return errno == 0 ? x : SYSMIS;
40 #define check_errno(EXPRESSION) (errno = 0, check_errno (EXPRESSION))
42 #define DAY_S (60. * 60. * 24.) /* Seconds per day. */
43 #define DAY_H 24. /* Hours per day. */
44 #define H_S (60 * 60.) /* Seconds per hour. */
45 #define H_MIN 60. /* Minutes per hour. */
46 #define MIN_S 60. /* Seconds per minute. */
47 #define WEEK_DAY 7. /* Days per week. */
49 extern const struct substring empty_string;
51 int compare_string (const struct substring *, const struct substring *);
53 double expr_ymd_to_date (double year, double month, double day);
54 double expr_ymd_to_ofs (double year, double month, double day);
55 double expr_wkyr_to_date (double wk, double yr);
56 double expr_yrday_to_date (double yr, double day);
57 double expr_yrmoda (double year, double month, double day);
59 struct substring alloc_string (struct expression *, size_t length);
60 struct substring copy_string (struct expression *,
61 const char *, size_t length);
66 return finite (d) && d != SYSMIS;
69 size_t count_valid (double *, size_t);
71 double idf_beta (double P, double a, double b);
72 double ncdf_beta (double x, double a, double b, double lambda);
73 double npdf_beta (double x, double a, double b, double lambda);
75 double cdf_bvnor (double x0, double x1, double r);
77 double idf_fdist (double P, double a, double b);
79 #endif /* expressions/helpers.h */