AC_CHECK_MATH_FUNC(acosh, [.5])
AC_CHECK_MATH_FUNC(asin, [.5])
AC_CHECK_MATH_FUNC(asinh, [.5])
-AC_CHECK_MATH_FUNC(atan, [.5])
AC_CHECK_MATH_FUNC(atan2, [.5,.5])
+AC_CHECK_MATH_FUNC(atan, [.5])
AC_CHECK_MATH_FUNC(atanh, [.5])
AC_CHECK_MATH_FUNC(cbrt, [.5])
+AC_CHECK_MATH_FUNC(ceil,[.5])
+AC_CHECK_MATH_FUNC(copysign,[.5,1.0])
AC_CHECK_MATH_FUNC(cos, [.5])
AC_CHECK_MATH_FUNC(cosh, [.5])
-AC_CHECK_MATH_FUNC(exp, [.5])
+AC_CHECK_MATH_FUNC(drem,[.5,1.0])
+AC_CHECK_MATH_FUNC(erf,[.5])
+AC_CHECK_MATH_FUNC(erfc,[.5])
+AC_CHECK_MATH_FUNC(exp10,[.5])
AC_CHECK_MATH_FUNC(exp2, [.5])
+AC_CHECK_MATH_FUNC(exp, [.5])
+AC_CHECK_MATH_FUNC(expm1,[.5])
+AC_CHECK_MATH_FUNC(fabs,[.5])
+AC_CHECK_MATH_FUNC(fdim,[.5,1.0])
AC_CHECK_MATH_FUNC(floor, [.5])
+AC_CHECK_MATH_FUNC(fma,[.5,1.0,1.5])
+AC_CHECK_MATH_FUNC(fmax,[.5,1.0])
+AC_CHECK_MATH_FUNC(fmin,[.5,1.0])
+AC_CHECK_MATH_FUNC(fmod,[.5,1.0])
+AC_CHECK_MATH_FUNC(frexp,[.5,1.0])
+AC_CHECK_MATH_FUNC(gamma,[.5])
AC_CHECK_MATH_FUNC(hypot, [.5,.5])
AC_CHECK_MATH_FUNC(j0, [.5])
AC_CHECK_MATH_FUNC(j1, [.5])
-AC_CHECK_MATH_FUNC(log, [.5])
+AC_CHECK_MATH_FUNC(ldexp,[.5,2])
+AC_CHECK_MATH_FUNC(lgamma,[.5])
AC_CHECK_MATH_FUNC(log10, [.5])
+AC_CHECK_MATH_FUNC(log1p,[.5])
AC_CHECK_MATH_FUNC(log2, [.5])
+AC_CHECK_MATH_FUNC(log, [.5])
+AC_CHECK_MATH_FUNC(logb,[.5])
+AC_CHECK_MATH_FUNC(modf,[.5,1.0])
+AC_CHECK_MATH_FUNC(nearbyint,[.5])
+AC_CHECK_MATH_FUNC(nextafter,[.5,1.0])
+AC_CHECK_MATH_FUNC(nexttoward,[.5,1.0])
+AC_CHECK_MATH_FUNC(pow10,[.5])
AC_CHECK_MATH_FUNC(pow, [2,2])
AC_CHECK_MATH_FUNC(remainder, [3,2])
+AC_CHECK_MATH_FUNC(rint,[.5])
+AC_CHECK_MATH_FUNC(round,[.5])
+AC_CHECK_MATH_FUNC(scalb,[.5,1.0])
+AC_CHECK_MATH_FUNC(scalbln,[.5,2])
+AC_CHECK_MATH_FUNC(significand,[.5])
AC_CHECK_MATH_FUNC(sin, [.5])
AC_CHECK_MATH_FUNC(sinh, [.5])
AC_CHECK_MATH_FUNC(sqrt, [.5])
AC_CHECK_MATH_FUNC(tan, [.5])
AC_CHECK_MATH_FUNC(tanh, [.5])
AC_CHECK_MATH_FUNC(tgamma, [.5])
+AC_CHECK_MATH_FUNC(trunc,[.5])
AC_CHECK_MATH_FUNC(y0, [.5])
AC_CHECK_MATH_FUNC(y1, [.5])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
-
that take a single input argument (e.g., `sin()`) are available as
zero-argument jq functions. C math functions that take two input
arguments (e.g., `pow()`) are available as two-argument jq
- functions that ignore `.`.
+ functions that ignore `.`. C math functions that take three input
+ arguments are available as three-argument jq functions that ignore
+ `.`.
Availability of standard math functions depends on the
availability of the corresponding math functions in your operating
system and C math library. Unavailable math functions will be
defined but will raise an error.
+ One-input C math functions: `acos` `acosh` `asin` `asinh` `atan`
+ `atanh` `cbrt` `ceil` `cos` `cosh` `erf` `erfc` `exp` `exp10`
+ `exp2` `expm1` `fabs` `floor` `gamma` `j0` `j1` `lgamma` `log`
+ `log10` `log1p` `log2` `logb` `nearbyint` `pow10` `rint` `round`
+ `significand` `sin` `sinh` `sqrt` `tan` `tanh` `tgamma` `trunc`
+ `y0` `y1`.
+
+ Two-input C math functions: `atan2` `copysign` `drem` `fdim`
+ `fmax` `fmin` `fmod` `frexp` `hypot` `jn` `ldexp` `modf`
+ `nextafter` `nexttoward` `pow` `remainder` `scalb` `scalbln` `yn`.
+
+ Three-input C math functions: `fma`.
+
+ See your system's manual for more information on each of these.
+
- title: 'I/O'
body: |
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
-.TH "JQ" "1" "January 2017" "" ""
+.TH "JQ" "1" "February 2017" "" ""
.
.SH "NAME"
\fBjq\fR \- Command\-line JSON processor
jq currently only has IEEE754 double\-precision (64\-bit) floating point number support\.
.
.P
-Besides simple arithmetic operators such as \fB+\fR, jq also has most standard math functions from the C math library\. C math functions that take a single input argument (e\.g\., \fBsin()\fR) are available as zero\-argument jq functions\. C math functions that take two input arguments (e\.g\., \fBpow()\fR) are available as two\-argument jq functions that ignore \fB\.\fR\.
+Besides simple arithmetic operators such as \fB+\fR, jq also has most standard math functions from the C math library\. C math functions that take a single input argument (e\.g\., \fBsin()\fR) are available as zero\-argument jq functions\. C math functions that take two input arguments (e\.g\., \fBpow()\fR) are available as two\-argument jq functions that ignore \fB\.\fR\. C math functions that take three input arguments are available as three\-argument jq functions that ignore \fB\.\fR\.
.
.P
Availability of standard math functions depends on the availability of the corresponding math functions in your operating system and C math library\. Unavailable math functions will be defined but will raise an error\.
.
+.P
+One\-input C math functions: \fBacos\fR \fBacosh\fR \fBasin\fR \fBasinh\fR \fBatan\fR \fBatanh\fR \fBcbrt\fR \fBceil\fR \fBcos\fR \fBcosh\fR \fBerf\fR \fBerfc\fR \fBexp\fR \fBexp10\fR \fBexp2\fR \fBexpm1\fR \fBfabs\fR \fBfloor\fR \fBgamma\fR \fBj0\fR \fBj1\fR \fBlgamma\fR \fBlog\fR \fBlog10\fR \fBlog1p\fR \fBlog2\fR \fBlogb\fR \fBnearbyint\fR \fBpow10\fR \fBrint\fR \fBround\fR \fBsignificand\fR \fBsin\fR \fBsinh\fR \fBsqrt\fR \fBtan\fR \fBtanh\fR \fBtgamma\fR \fBtrunc\fR \fBy0\fR \fBy1\fR\.
+.
+.P
+Two\-input C math functions: \fBatan2\fR \fBcopysign\fR \fBdrem\fR \fBfdim\fR \fBfmax\fR \fBfmin\fR \fBfmod\fR \fBfrexp\fR \fBhypot\fR \fBjn\fR \fBldexp\fR \fBmodf\fR \fBnextafter\fR \fBnexttoward\fR \fBpow\fR \fBremainder\fR \fBscalb\fR \fBscalbln\fR \fByn\fR\.
+.
+.P
+Three\-input C math functions: \fBfma\fR\.
+.
+.P
+See your system\'s manual for more information on each of these\.
+.
.SH "I/O"
At this time jq has minimal support for I/O, mostly in the form of control over when inputs are read\. Two builtins functions are provided for this, \fBinput\fR and \fBinputs\fR, that read from the same sources (e\.g\., \fBstdin\fR, files named on the command\-line) as jq itself\. These two builtins, and jq\'s own reading actions, can be interleaved with each other\.
.
return ret; \
}
#define LIBM_DDD_NO(name)
+
+#define LIBM_DDDD(name) \
+static jv f_ ## name(jq_state *jq, jv input, jv a, jv b, jv c) { \
+ if (jv_get_kind(a) != JV_KIND_NUMBER || jv_get_kind(b) != JV_KIND_NUMBER) \
+ return type_error(input, "number required"); \
+ jv_free(input); \
+ jv ret = jv_number(name(jv_number_value(a), jv_number_value(b), jv_number_value(c))); \
+ jv_free(a); \
+ jv_free(b); \
+ jv_free(c); \
+ return ret; \
+}
+#define LIBM_DDDD_NO(name)
#include "libm.h"
+#undef LIBM_DDDD_NO
#undef LIBM_DDD_NO
#undef LIBM_DD_NO
+#undef LIBM_DDDD
#undef LIBM_DDD
#undef LIBM_DD
{(cfunction_ptr)f_ ## name, "_" #name, 3},
#define LIBM_DDD_NO(name)
+#define LIBM_DDDD(name) \
+ {(cfunction_ptr)f_ ## name, "_" #name, 4},
+#define LIBM_DDDD_NO(name)
+
static const struct cfunction function_list[] = {
#include "libm.h"
{(cfunction_ptr)f_plus, "_plus", 3},
{(cfunction_ptr)f_current_filename, "input_filename", 1},
{(cfunction_ptr)f_current_line, "input_line_number", 1},
};
+#undef LIBM_DDDD_NO
#undef LIBM_DDD_NO
#undef LIBM_DD_NO
+#undef LIBM_DDDD
#undef LIBM_DDD
#undef LIBM_DD
#define LIBM_DD(name) "def " #name ": _" #name ";"
#define LIBM_DDD(name) "def " #name "(a;b): _" #name "(a;b);"
+#define LIBM_DDDD(name) "def " #name "(a;b;c): _" #name "(a;b;c);"
#define LIBM_DD_NO(name)
#define LIBM_DDD_NO(name)
+#define LIBM_DDDD_NO(name)
static const char* const jq_builtins =
/* Include supported math functions first */
#include "src/builtin.inc"
/* Include unsupported math functions next */
+#undef LIBM_DDDD_NO
#undef LIBM_DDD_NO
#undef LIBM_DD_NO
+#undef LIBM_DDDD
#undef LIBM_DDD
#undef LIBM_DD
#define LIBM_DD(name)
#define LIBM_DDD(name)
+#define LIBM_DDDD(name)
#define LIBM_DD_NO(name) "def " #name ": \"Error: " #name "() not found at build time\"|error;"
#define LIBM_DDD_NO(name) "def " #name "(a;b): \"Error: " #name "() not found at build time\"|error;"
+#define LIBM_DDDD_NO(name) "def " #name "(a;b;c): \"Error: " #name "() not found at build time\"|error;"
#include "libm.h"
;
+#undef LIBM_DDDD_NO
#undef LIBM_DDD_NO
#undef LIBM_DD_NO
+#undef LIBM_DDDD
#undef LIBM_DDD
#undef LIBM_DD