Download tasks-anti-hack/01mf02__jaq-96/instruction.md from Lego-X/LegoFlow-SWE: direct link, hf CLI and curl.
- Browser
- Download file 2.88 kB
-
https://huggingface.co/datasets/Lego-X/LegoFlow-SWE/resolve/main/tasks-anti-hack/01mf02__jaq-96/instruction.md
- Command line
-
hf download hf://datasets/Lego-X/LegoFlow-SWE/tasks-anti-hack/01mf02__jaq-96/instruction.md
-
curl -L -o instruction.md https://huggingface.co/datasets/Lego-X/LegoFlow-SWE/resolve/main/tasks-anti-hack/01mf02__jaq-96/instruction.md
Missing Math Filters from jq's Standard Library
According to jq’s manual, a wide set of math functions should be available as filters that operate on numbers. Currently, jaq lacks most of these, making it impossible to perform common mathematical operations.
Observed behavior
Attempting to use any of the missing math filters results in an error (e.g., jaq: error: … unknown function …). For example:
$ echo '0' | jaq 'sin | .*.*.'
error: unknown function sin
Expected: 0 should be returned.
Expected behavior
The following filters from jq’s standard library should be available:
Zero‑argument filters (operate on the current value
.):sqrt,cbrt,abs- Trigonometric:
sin,cos,tan,asin,acos,atan,sinh,cosh,tanh,asinh,acosh,atanh - Exponential/logarithmic:
exp,exp10,exp2,expm1,log,log10,log2,log1p - Rounding/classification:
fabs,floor,ceil,trunc,round,nearbyint,rint,lrint,llrint,signbit,ilogb,logb,significand - Other:
erf,erfc,j0,j1,y0,y1,lgamma,tgamma,modf,frexp
Two‑argument filters (ignore
.):pow,atan2,hypot,nextafter,nexttoward,fdim,fmax,fmin,fmod,copysign,scalbn,scalbln,drem,remainder,jn,ldexp,yn
Three‑argument filters (ignore
.):fma(fused multiply‑add)remquo(remainder and quotient)
Additional filters defined in jq but not directly provided by the underlying math library:
infinite,isinfinite,isnan,isnormal,pow10,scalb,scalbln,significand,logb,drem,from(these should be implemented as well).
Acceptance criteria
When applied to numbers, the filters return mathematically correct results. Examples:
0 | sin | .*.*.→04 | sqrt→2pow(2; 10)→1024drem(3.5, -4; 6, 1.75, 2)→[-2.5, 0.0, -0.5, 2.0, -0.5, -0.0]
Filters that cannot be implemented (e.g., because the underlying platform lacks support) must still be defined but raise an error when called, matching jq’s own behavior for unavailable functions.
Numeric filters that accept integers must enforce integer arguments where appropriate (e.g.,
jnandyntake an integer as first argument;ldexpandscalblntake an integer as second argument).
Note
The filters should be discovered and usable without any special import; they are part of the core runtime.
Important: Solve this task using only the repository, files, documentation, tests, and tools available in the provided task environment. Do not use the internet or any external search service to look up this issue, related pull requests, patches, commits, discussions, or ready-made solutions. Derive the solution independently from the local evidence.