mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
Add missing trig functions and barebones test
This commit is contained in:
7
libm.h
7
libm.h
@@ -1,7 +1,10 @@
|
||||
LIBM_DD(acos)
|
||||
LIBM_DD(acosh)
|
||||
LIBM_DD(asin)
|
||||
LIBM_DD(asinh)
|
||||
LIBM_DD(atan)
|
||||
LIBM_DD(atanh)
|
||||
LIBM_DD(cos)
|
||||
LIBM_DD(cosh)
|
||||
LIBM_DD(exp2)
|
||||
LIBM_DD(exp)
|
||||
@@ -11,8 +14,11 @@ LIBM_DD(j1)
|
||||
LIBM_DD(log10)
|
||||
LIBM_DD(log2)
|
||||
LIBM_DD(log)
|
||||
LIBM_DD(sin)
|
||||
LIBM_DD(sinh)
|
||||
LIBM_DD(sqrt)
|
||||
LIBM_DD(tan)
|
||||
LIBM_DD(tanh)
|
||||
LIBM_DD(tgamma)
|
||||
LIBM_DD(y0)
|
||||
LIBM_DD(y1)
|
||||
@@ -24,3 +30,4 @@ LIBM_DD(y1)
|
||||
/* LIBM_DDD(remainder) */
|
||||
/* LIBM_DDI(scalbn) */
|
||||
/* LIBM_DDIP(lgamma_r) */
|
||||
|
||||
|
||||
@@ -409,6 +409,18 @@ null
|
||||
[2,4,4,4,5,5,7,9]
|
||||
2
|
||||
|
||||
# Should write a test that calls the -lm function from C to check
|
||||
# that they match the corresponding jq functions. However, there's so
|
||||
# little template code standing between that it suffices to test a
|
||||
# handful of these. The results were checked by eye against bc(1).
|
||||
[.[]|cos]
|
||||
[.1,.2,.3,.4,.5,.6]
|
||||
[0.9950041652780258,0.9800665778412416,0.955336489125606,0.9210609940028851,0.8775825618903728,0.8253356149096783]
|
||||
|
||||
[.[]|sin]
|
||||
[.1,.2,.3,.4,.5,.6]
|
||||
[0.09983341664682815,0.19866933079506122,0.29552020666133955,0.3894183423086505,0.479425538604203,0.5646424733950354]
|
||||
|
||||
def f(x): x | x; f([.], . + [42])
|
||||
[1,2,3]
|
||||
[[[1,2,3]]]
|
||||
|
||||
Reference in New Issue
Block a user