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>
14 #include "dictionary.h"
25 static inline double check_errno (double x)
27 return errno == 0 ? x : SYSMIS;
30 #define check_errno(EXPRESSION) (errno = 0, check_errno (EXPRESSION))
32 #define DAY_S (60. * 60. * 24.) /* Seconds per day. */
33 #define DAY_H 24. /* Hours per day. */
34 #define H_S (60 * 60.) /* Seconds per hour. */
35 #define H_MIN 60. /* Minutes per hour. */
36 #define MIN_S 60. /* Seconds per minute. */
37 #define WEEK_DAY 7. /* Days per week. */
39 extern const struct fixed_string empty_string;
41 int compare_string (const struct fixed_string *, const struct fixed_string *);
43 double expr_ymd_to_date (double year, double month, double day);
44 double expr_ymd_to_ofs (double year, double month, double day);
45 double expr_wkyr_to_date (double wk, double yr);
46 double expr_yrday_to_date (double yr, double day);
47 double expr_yrmoda (double year, double month, double day);
49 struct fixed_string alloc_string (struct expression *, size_t length);
50 struct fixed_string copy_string (struct expression *,
51 const char *, size_t length);
56 return finite (d) && d != SYSMIS;
59 size_t count_valid (double *, size_t);
61 double idf_beta (double P, double a, double b);
62 double ncdf_beta (double x, double a, double b, double lambda);
63 double npdf_beta (double x, double a, double b, double lambda);
65 double cdf_bvnor (double x0, double x1, double r);
67 double idf_fdist (double P, double a, double b);
69 #endif /* expressions/helpers.h */