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>
12 #include <data/case.h>
13 #include <libpspp/compiler.h>
14 #include <data/data-in.h>
15 #include <data/dictionary.h>
16 #include <libpspp/message.h>
17 #include <data/calendar.h>
18 #include <gsl-extras/gsl-extras.h>
19 #include <libpspp/misc.h>
20 #include <math/moments.h>
21 #include <math/random.h>
22 #include <data/settings.h>
23 #include <libpspp/str.h>
24 #include <data/value.h>
25 #include <data/variable.h>
26 #include <procedure.h>
29 #define _(msgid) gettext (msgid)
31 static inline double check_errno (double x)
33 return errno == 0 ? x : SYSMIS;
36 #define check_errno(EXPRESSION) (errno = 0, check_errno (EXPRESSION))
38 #define DAY_S (60. * 60. * 24.) /* Seconds per day. */
39 #define DAY_H 24. /* Hours per day. */
40 #define H_S (60 * 60.) /* Seconds per hour. */
41 #define H_MIN 60. /* Minutes per hour. */
42 #define MIN_S 60. /* Seconds per minute. */
43 #define WEEK_DAY 7. /* Days per week. */
45 extern const struct fixed_string empty_string;
47 int compare_string (const struct fixed_string *, const struct fixed_string *);
49 double expr_ymd_to_date (double year, double month, double day);
50 double expr_ymd_to_ofs (double year, double month, double day);
51 double expr_wkyr_to_date (double wk, double yr);
52 double expr_yrday_to_date (double yr, double day);
53 double expr_yrmoda (double year, double month, double day);
55 struct fixed_string alloc_string (struct expression *, size_t length);
56 struct fixed_string copy_string (struct expression *,
57 const char *, size_t length);
62 return finite (d) && d != SYSMIS;
65 size_t count_valid (double *, size_t);
67 double idf_beta (double P, double a, double b);
68 double ncdf_beta (double x, double a, double b, double lambda);
69 double npdf_beta (double x, double a, double b, double lambda);
71 double cdf_bvnor (double x0, double x1, double r);
73 double idf_fdist (double P, double a, double b);
75 #endif /* expressions/helpers.h */