summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorpkoppstein <pkoppstein@gmail.com>2023-07-24 23:25:42 -0400
committerNico Williams <nico@cryptonector.com>2023-07-25 23:43:57 -0500
commit7b725378b9803a1df74054ebd3d700d9daeb2049 (patch)
treefd279b6868d12ca5b79e97989eb8439d1d7608cb /docs
parent3a1ba0c42d2deb80b3f94b7993c7096cfe33b3bb (diff)
builtin.jq: naive abs/0
manual.yml explains that the def is naive, and mentions fabs, etc.
Diffstat (limited to 'docs')
-rw-r--r--docs/content/manual/manual.yml15
1 files changed, 15 insertions, 0 deletions
diff --git a/docs/content/manual/manual.yml b/docs/content/manual/manual.yml
index ae9a8498..7f28150d 100644
--- a/docs/content/manual/manual.yml
+++ b/docs/content/manual/manual.yml
@@ -850,6 +850,21 @@ sections:
input: '[1,0,-1]'
output: ['1', '-1']
+ - title: "`abs`"
+ body: |
+
+ The builtin function `abs` is defined naively as: `if . < 0 then - . else . end`.
+
+ For numeric input, this is the absolute value. See the
+ section on the identity filter for the implications of this
+ definition for numeric input.
+
+ To compute the absolute value of a number as a floating point number, you may wish use `fabs`.
+
+ examples:
+ - program: 'map(abs)'
+ input: '[-10, -1.1, -1e-1, 1000000000000000002, -1000000000000000002]'
+ output: ['[10,1.1,1e-1,10000000000000002,1e+18]']
- title: "`length`"
body: |