summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2015-06-17 19:46:57 -0500
committerNicolas Williams <nico@cryptonector.com>2015-06-17 19:58:55 -0500
commitb9c2a326bae085a27b5bd01ca15c3c42c7b726a3 (patch)
treec02b01953ebc29327d6424748d2761c51756fb3b /docs
parentbdc1feb50e6df19eac2bd23b546d37fffeee05f1 (diff)
Fix #814: raise on div-0, add inf isinf nan isnan
Diffstat (limited to 'docs')
-rw-r--r--docs/content/3.manual/manual.yml24
1 files changed, 23 insertions, 1 deletions
diff --git a/docs/content/3.manual/manual.yml b/docs/content/3.manual/manual.yml
index 8a4f77a1..8a3e20aa 100644
--- a/docs/content/3.manual/manual.yml
+++ b/docs/content/3.manual/manual.yml
@@ -598,7 +598,7 @@ sections:
that string that many times.
Dividing a string by another splits the first using the second
- as separators.
+ as separators. Division by zero raises an error.
Multiplying two objects will merge them recursively: this works
like addition but if both objects contain a value for the
@@ -615,6 +615,9 @@ sections:
- program: '{"k": {"a": 1, "b": 2}} * {"k": {"a": 0,"c": 3}}'
input: 'null'
output: ['{"k": {"a": 0, "b": 2, "c": 3}}']
+ - program: '.[] | (1 / .)?'
+ input: '[1,0,-1]'
+ output: ['1', '-1']
- title: "`length`"
@@ -1073,6 +1076,25 @@ sections:
input: '[0, false, [], {}, null, "hello"]'
output: ['["number", "boolean", "array", "object", "null", "string"]']
+ - title: "`inf`, `nan`, `isinf`, `isnan`"
+ body: |
+
+ Some arithmetic operations can yield infinities and "not a
+ number" (NaN) values. The `isinf` builtin returns `true` if
+ its input is infinite. The `isnan` builtin returns `true` if
+ its input is a NaN. The `inf` builtin returns a positive
+ infinite value. The `nan` builtin returns a NaN.
+
+ Note that division by zero raises an error.
+
+ examples:
+ - program: '.[] | (inf * .) < 0'
+ input: '[-1, 1]'
+ output: ['true', 'false']
+ - program: 'inf, nan | type'
+ input: 'null'
+ output: ['"number"']
+
- title: "`sort, sort_by(path_expression)`"
body: |