From 933e0aa6b175b86f7966781d63ffabfd255cb7da Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Tue, 24 Oct 2023 18:02:45 +0200 Subject: [PATCH 1/6] divide, ln, log, mod: Clarified behavior for 0 input / infinity results --- CHANGELOG.md | 6 ++++++ divide.json | 4 ++-- ln.json | 4 ++-- log.json | 4 ++-- mod.json | 4 ++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 407447dc..30e3883c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased / Draft +### Fixed + +- `divide`: Clarified behavior for division by 0 +- `ln` and `log`: Clarified that for x = 0 -infinity is returned +- `mod`: Clarified behavior for y = 0 + ## [2.0.0-rc.1] - 2023-05-25 ### Added diff --git a/divide.json b/divide.json index 5dd664f1..0c6c254a 100644 --- a/divide.json +++ b/divide.json @@ -1,7 +1,7 @@ { "id": "divide", "summary": "Division of two numbers", - "description": "Divides argument `x` by the argument `y` (*`x / y`*) and returns the computed result.\n\nNo-data values are taken into account so that `null` is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, a division by zero results in ±infinity if the processing environment supports it. Otherwise, a `DivisionByZero` exception must the thrown.", + "description": "Divides argument `x` by the argument `y` (*`x / y`*) and returns the computed result.\n\nNo-data values are taken into account so that `null` is returned if any element is such a value.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. A division by zero results in:\n\n- +infinity for `x` > 0,\n- -infinity for `x` < 0,\n- `NaN` for `x` = 0,\n- or otherwise, throws a `DivisionByZero` exception if the other options are not supported by the processing environment.", "categories": [ "math" ], @@ -76,4 +76,4 @@ "title": "IEEE Standard 754-2019 for Floating-Point Arithmetic" } ] -} \ No newline at end of file +} diff --git a/ln.json b/ln.json index e073c7a2..7b40a30a 100644 --- a/ln.json +++ b/ln.json @@ -1,7 +1,7 @@ { "id": "ln", "summary": "Natural logarithm", - "description": "The natural logarithm is the logarithm to the base *e* of the number `x`, which equals to using the *log* process with the base set to *e*. The natural logarithm is the inverse function of taking *e* to the power x.\n\nThe no-data value `null` is passed through.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`ln(0)`* results in ±infinity if the processing environment supports it or otherwise an exception is thrown.", + "description": "The natural logarithm is the logarithm to the base *e* of the number `x`, which equals to using the *log* process with the base set to *e*. The natural logarithm is the inverse function of taking *e* to the power x.\n\nThe no-data value `null` is passed through.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`ln(0)`* results in -infinity if the processing environment supports it. Otherwise, an exception is thrown.", "categories": [ "math > exponential & logarithmic" ], @@ -64,4 +64,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/log.json b/log.json index 89500837..e525e9f0 100644 --- a/log.json +++ b/log.json @@ -1,7 +1,7 @@ { "id": "log", "summary": "Logarithm to a base", - "description": "Logarithm to the base `base` of the number `x` is defined to be the inverse function of taking b to the power of x.\n\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, `log(0, 2)` results in ±infinity if the processing environment supports it or otherwise an exception is thrown.", + "description": "Logarithm to the base `base` of the number `x` is defined to be the inverse function of taking b to the power of x.\n\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, having `x` set to `0` with any base results in -infinity if the processing environment supports it. Otherwise, an exception is thrown.", "categories": [ "math > exponential & logarithmic" ], @@ -78,4 +78,4 @@ "title": "IEEE Standard 754-2019 for Floating-Point Arithmetic" } ] -} \ No newline at end of file +} diff --git a/mod.json b/mod.json index ca709386..0c8a6ea9 100644 --- a/mod.json +++ b/mod.json @@ -1,7 +1,7 @@ { "id": "mod", "summary": "Modulo", - "description": "Remainder after a division of `x` by `y` for both integers and floating-point numbers.\n\nThe result of a modulo operation has the sign of the divisor. The handling regarding the sign of the result [differs between programming languages](https://en.wikipedia.org/wiki/Modulo_operation#In_programming_languages) and needs careful consideration to avoid unexpected results.\n\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`. A modulo by zero results in ±infinity if the processing environment supports it. Otherwise, a `DivisionByZero` exception must the thrown.", + "description": "Remainder after a division of `x` by `y` for both integers and floating-point numbers.\n\nThe result of a modulo operation has the sign of the divisor. The handling regarding the sign of the result [differs between programming languages](https://en.wikipedia.org/wiki/Modulo_operation#In_programming_languages) and needs careful consideration to avoid unexpected results.\n\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`. If `y` is set to 0 this results in:\n\n- +infinity for `x` > 0,\n- -infinity for `x` < 0,\n- `NaN` for `x` = 0,\n- or otherwise, throws a `DivisionByZero` exception if the other options are not supported by the processing environment.", "categories": [ "math" ], @@ -92,4 +92,4 @@ "title": "Modulo explained by Wikipedia" } ] -} \ No newline at end of file +} From eb9cc92666545065dd2f1af38d99ddb65ced8564 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Tue, 24 Oct 2023 20:00:24 +0200 Subject: [PATCH 2/6] Trigonometric functions: Clarified that NaN is returned outside of their defined ranges and the output value range for some processes --- CHANGELOG.md | 4 ++++ arccos.json | 7 ++++--- arcosh.json | 7 ++++--- arcsin.json | 4 ++-- artanh.json | 8 +++++--- cos.json | 6 ++++-- cosh.json | 5 +++-- sin.json | 6 ++++-- tan.json | 4 ++-- tanh.json | 6 ++++-- 10 files changed, 36 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 407447dc..fb753cd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased / Draft +### Fixed + +- Trigonometric functions: Clarified that NaN is returned outside of their defined input range and defined output ranges where possible. + ## [2.0.0-rc.1] - 2023-05-25 ### Added diff --git a/arccos.json b/arccos.json index 5ffbce35..663eab98 100644 --- a/arccos.json +++ b/arccos.json @@ -1,7 +1,7 @@ { "id": "arccos", "summary": "Inverse cosine", - "description": "Computes the arc cosine of `x`. The arc cosine is the inverse function of the cosine so that *`arccos(cos(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the arc cosine of `x`. The arc cosine is the inverse function of the cosine so that *`arccos(cos(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values < -1 and > 1.", "categories": [ "math > trigonometric" ], @@ -23,7 +23,8 @@ "type": [ "number", "null" - ] + ], + "minimum": 0 } }, "examples": [ @@ -41,4 +42,4 @@ "title": "Inverse cosine explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/arcosh.json b/arcosh.json index 6ed581fe..1f297535 100644 --- a/arcosh.json +++ b/arcosh.json @@ -1,7 +1,7 @@ { "id": "arcosh", "summary": "Inverse hyperbolic cosine", - "description": "Computes the inverse hyperbolic cosine of `x`. It is the inverse function of the hyperbolic cosine so that *`arcosh(cosh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the inverse hyperbolic cosine of `x`. It is the inverse function of the hyperbolic cosine so that *`arcosh(cosh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values < 1.", "categories": [ "math > trigonometric" ], @@ -23,7 +23,8 @@ "type": [ "number", "null" - ] + ], + "minimum": 0 } }, "examples": [ @@ -41,4 +42,4 @@ "title": "Inverse hyperbolic cosine explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/arcsin.json b/arcsin.json index e37eb2d3..011d7417 100644 --- a/arcsin.json +++ b/arcsin.json @@ -1,7 +1,7 @@ { "id": "arcsin", "summary": "Inverse sine", - "description": "Computes the arc sine of `x`. The arc sine is the inverse function of the sine so that *`arcsin(sin(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the arc sine of `x`. The arc sine is the inverse function of the sine so that *`arcsin(sin(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values < -1 and > 1.", "categories": [ "math > trigonometric" ], @@ -41,4 +41,4 @@ "title": "Inverse sine explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/artanh.json b/artanh.json index 926b48ea..0d018e35 100644 --- a/artanh.json +++ b/artanh.json @@ -1,7 +1,7 @@ { "id": "artanh", "summary": "Inverse hyperbolic tangent", - "description": "Computes the inverse hyperbolic tangent of `x`. It is the inverse function of the hyperbolic tangent so that *`artanh(tanh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the inverse hyperbolic tangent of `x`. It is the inverse function of the hyperbolic tangent so that *`artanh(tanh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values <= -1 and >= 1.", "categories": [ "math > trigonometric" ], @@ -13,7 +13,9 @@ "type": [ "number", "null" - ] + ], + "minimumExclusive": -1, + "maximumExclusive": 1 } } ], @@ -41,4 +43,4 @@ "title": "Inverse hyperbolic tangent explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/cos.json b/cos.json index 6e6e4143..95814c20 100644 --- a/cos.json +++ b/cos.json @@ -23,7 +23,9 @@ "type": [ "number", "null" - ] + ], + "minimum": -1, + "maximum": 1 } }, "examples": [ @@ -41,4 +43,4 @@ "title": "Cosine explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/cosh.json b/cosh.json index 975958a4..7a6f057c 100644 --- a/cosh.json +++ b/cosh.json @@ -23,7 +23,8 @@ "type": [ "number", "null" - ] + ], + "minimum": 1 } }, "examples": [ @@ -41,4 +42,4 @@ "title": "Hyperbolic cosine explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/sin.json b/sin.json index 06c45cc4..6f4eee6f 100644 --- a/sin.json +++ b/sin.json @@ -23,7 +23,9 @@ "type": [ "number", "null" - ] + ], + "minimum": -1, + "maximum": 1 } }, "examples": [ @@ -41,4 +43,4 @@ "title": "Sine explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/tan.json b/tan.json index c3952efa..2f2bb3d8 100644 --- a/tan.json +++ b/tan.json @@ -1,7 +1,7 @@ { "id": "tan", "summary": "Tangent", - "description": "Computes the tangent of `x`. The tangent is defined to be the sine of x divided by the cosine of x.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the tangent of `x`. The tangent is defined to be the sine of x divided by the cosine of x.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values where the tangent function is not defined.", "categories": [ "math > trigonometric" ], @@ -41,4 +41,4 @@ "title": "Tangent explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/tanh.json b/tanh.json index 203f581e..9d44d4ee 100644 --- a/tanh.json +++ b/tanh.json @@ -23,7 +23,9 @@ "type": [ "number", "null" - ] + ], + "minimum": -1, + "maximum": 1 } }, "examples": [ @@ -41,4 +43,4 @@ "title": "Hyperbolic tangent explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} From 5287285de007f06c3c24d47890361d2717db0f17 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Thu, 26 Oct 2023 20:52:01 +0200 Subject: [PATCH 3/6] Clarified for various mathematical functions the defined input and output ranges. Mention that `NaN` is returned outside of the defined input range where possible. --- CHANGELOG.md | 2 +- absolute.json | 4 ++-- arccos.json | 10 ++++++---- arcosh.json | 9 +++++---- arcsin.json | 8 +++++--- arctan.json | 4 ++-- artanh.json | 4 ++-- cos.json | 2 +- cosh.json | 2 +- exp.json | 7 ++++--- ln.json | 9 +++++---- log.json | 9 +++++---- sgn.json | 8 +++++++- sin.json | 2 +- sinh.json | 4 ++-- tan.json | 2 +- tanh.json | 6 +++--- 17 files changed, 53 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb753cd8..917af937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Trigonometric functions: Clarified that NaN is returned outside of their defined input range and defined output ranges where possible. +- Clarified for various mathematical functions the defined input and output ranges. Mention that `NaN` is returned outside of the defined input range where possible. ## [2.0.0-rc.1] - 2023-05-25 diff --git a/absolute.json b/absolute.json index 3b6e91dc..c6a3713d 100644 --- a/absolute.json +++ b/absolute.json @@ -1,7 +1,7 @@ { "id": "absolute", "summary": "Absolute value", - "description": "Computes the absolute value of a real number `x`, which is the \"unsigned\" portion of x and often denoted as *|x|*.\n\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the absolute value of a real number `x`, which is the \"unsigned\" portion of `x` and often denoted as *|x|*.\n\nThe no-data value `null` is passed through and therefore gets propagated.", "categories": [ "math" ], @@ -95,4 +95,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/arccos.json b/arccos.json index 663eab98..4cd498a7 100644 --- a/arccos.json +++ b/arccos.json @@ -1,24 +1,26 @@ { "id": "arccos", "summary": "Inverse cosine", - "description": "Computes the arc cosine of `x`. The arc cosine is the inverse function of the cosine so that *`arccos(cos(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values < -1 and > 1.", + "description": "Computes the arc cosine of `x`. The arc cosine is the inverse function of the cosine so that *`arccos(cos(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range.", "categories": [ "math > trigonometric" ], "parameters": [ { "name": "x", - "description": "A number.", + "description": "A number in the range *[-1, 1]*.", "schema": { "type": [ "number", "null" - ] + ], + "minimum": -1, + "maximum": 1 } } ], "returns": { - "description": "The computed angle in radians.", + "description": "The computed angle in radians in the range *[0, π]*.", "schema": { "type": [ "number", diff --git a/arcosh.json b/arcosh.json index 1f297535..ee43e3f9 100644 --- a/arcosh.json +++ b/arcosh.json @@ -1,24 +1,25 @@ { "id": "arcosh", "summary": "Inverse hyperbolic cosine", - "description": "Computes the inverse hyperbolic cosine of `x`. It is the inverse function of the hyperbolic cosine so that *`arcosh(cosh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values < 1.", + "description": "Computes the inverse hyperbolic cosine of `x`. It is the inverse function of the hyperbolic cosine so that *`arcosh(cosh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range.", "categories": [ "math > trigonometric" ], "parameters": [ { "name": "x", - "description": "A number.", + "description": "A number in the range *[1, +∞)*.", "schema": { "type": [ "number", "null" ] - } + }, + "minimum": 1 } ], "returns": { - "description": "The computed angle in radians.", + "description": "The computed angle in radians in the range *[0, +∞)*.", "schema": { "type": [ "number", diff --git a/arcsin.json b/arcsin.json index 011d7417..2c772a00 100644 --- a/arcsin.json +++ b/arcsin.json @@ -8,17 +8,19 @@ "parameters": [ { "name": "x", - "description": "A number.", + "description": "A number in the range *[-1, 1]*.", "schema": { "type": [ "number", "null" - ] + ], + "minimum": -1, + "maximum": 1 } } ], "returns": { - "description": "The computed angle in radians.", + "description": "The computed angle in radians in the range *[-π/2, π/2]*.", "schema": { "type": [ "number", diff --git a/arctan.json b/arctan.json index dc8d5a68..9461eba3 100644 --- a/arctan.json +++ b/arctan.json @@ -18,7 +18,7 @@ } ], "returns": { - "description": "The computed angle in radians.", + "description": "The computed angle in radians in the range *(−π/2, π/2)*.", "schema": { "type": [ "number", @@ -41,4 +41,4 @@ "title": "Inverse tangent explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/artanh.json b/artanh.json index 0d018e35..38c0a65f 100644 --- a/artanh.json +++ b/artanh.json @@ -1,14 +1,14 @@ { "id": "artanh", "summary": "Inverse hyperbolic tangent", - "description": "Computes the inverse hyperbolic tangent of `x`. It is the inverse function of the hyperbolic tangent so that *`artanh(tanh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values <= -1 and >= 1.", + "description": "Computes the inverse hyperbolic tangent of `x`. It is the inverse function of the hyperbolic tangent so that *`artanh(tanh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range.", "categories": [ "math > trigonometric" ], "parameters": [ { "name": "x", - "description": "A number.", + "description": "A number in the range *(-1, 1)*.", "schema": { "type": [ "number", diff --git a/cos.json b/cos.json index 95814c20..0d6229a8 100644 --- a/cos.json +++ b/cos.json @@ -18,7 +18,7 @@ } ], "returns": { - "description": "The computed cosine of `x`.", + "description": "The computed cosine in the range *[-1, 1]*.", "schema": { "type": [ "number", diff --git a/cosh.json b/cosh.json index 7a6f057c..7c3574d7 100644 --- a/cosh.json +++ b/cosh.json @@ -18,7 +18,7 @@ } ], "returns": { - "description": "The computed hyperbolic cosine of `x`.", + "description": "The computed hyperbolic cosine in the range *[1, +∞)*.", "schema": { "type": [ "number", diff --git a/exp.json b/exp.json index 5a5e3283..2d551390 100644 --- a/exp.json +++ b/exp.json @@ -18,12 +18,13 @@ } ], "returns": { - "description": "The computed value for *e* raised to the power of `p`.", + "description": "The computed value for *e* raised to the power of `p`. Value is in the range of *(0, +∞)*", "schema": { "type": [ "number", "null" - ] + ], + "minimumExclusive": 0 } }, "examples": [ @@ -65,4 +66,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/ln.json b/ln.json index e073c7a2..1663771b 100644 --- a/ln.json +++ b/ln.json @@ -1,19 +1,20 @@ { "id": "ln", "summary": "Natural logarithm", - "description": "The natural logarithm is the logarithm to the base *e* of the number `x`, which equals to using the *log* process with the base set to *e*. The natural logarithm is the inverse function of taking *e* to the power x.\n\nThe no-data value `null` is passed through.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`ln(0)`* results in ±infinity if the processing environment supports it or otherwise an exception is thrown.", + "description": "The natural logarithm is the logarithm to the base *e* of the number `x`, which equals to using the *log* process with the base set to *e*. The natural logarithm is the inverse function of taking *e* to the power x.\n\nThe no-data value `null` is passed through.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`ln(0)`* results in -infinity if the processing environment supports it or otherwise an exception is thrown. `NaN` is returned for values outside of the allowed range.", "categories": [ "math > exponential & logarithmic" ], "parameters": [ { "name": "x", - "description": "A number to compute the natural logarithm for.", + "description": "A number to compute the natural logarithm for in the range *[0, +∞)*.", "schema": { "type": [ "number", "null" - ] + ], + "minimum": 0 } } ], @@ -64,4 +65,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/log.json b/log.json index 89500837..c81dca7f 100644 --- a/log.json +++ b/log.json @@ -1,19 +1,20 @@ { "id": "log", "summary": "Logarithm to a base", - "description": "Logarithm to the base `base` of the number `x` is defined to be the inverse function of taking b to the power of x.\n\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, `log(0, 2)` results in ±infinity if the processing environment supports it or otherwise an exception is thrown.", + "description": "Logarithm to the base `base` of the number `x` is defined to be the inverse function of taking b to the power of x.\n\nThe no-data value `null` is passed through and therefore gets propagated if any of the arguments is `null`.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, `log(0, 2)` results in -infinity if the processing environment supports it or otherwise an exception is thrown. `NaN` is returned for values outside of the allowed range.", "categories": [ "math > exponential & logarithmic" ], "parameters": [ { "name": "x", - "description": "A number to compute the logarithm for.", + "description": "A number to compute the logarithm for in the range *[0, +∞)*.", "schema": { "type": [ "number", "null" - ] + ], + "minimum": 0 } }, { @@ -78,4 +79,4 @@ "title": "IEEE Standard 754-2019 for Floating-Point Arithmetic" } ] -} \ No newline at end of file +} diff --git a/sgn.json b/sgn.json index f59afdc4..ecdbd9d1 100644 --- a/sgn.json +++ b/sgn.json @@ -23,6 +23,12 @@ "type": [ "number", "null" + ], + "enum": [ + -1, + 0, + 1, + null ] } }, @@ -104,4 +110,4 @@ "result": true } } -} \ No newline at end of file +} diff --git a/sin.json b/sin.json index 6f4eee6f..15285979 100644 --- a/sin.json +++ b/sin.json @@ -18,7 +18,7 @@ } ], "returns": { - "description": "The computed sine of `x`.", + "description": "The computed sine in the range *[-1, 1]*.", "schema": { "type": [ "number", diff --git a/sinh.json b/sinh.json index c505b3a3..026f477d 100644 --- a/sinh.json +++ b/sinh.json @@ -18,7 +18,7 @@ } ], "returns": { - "description": "The computed hyperbolic sine of `x`.", + "description": "The computed hyperbolic sine.", "schema": { "type": [ "number", @@ -41,4 +41,4 @@ "title": "Hyperbolic sine explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/tan.json b/tan.json index 2f2bb3d8..d9bd2425 100644 --- a/tan.json +++ b/tan.json @@ -18,7 +18,7 @@ } ], "returns": { - "description": "The computed tangent of `x`.", + "description": "The computed tangent.", "schema": { "type": [ "number", diff --git a/tanh.json b/tanh.json index 9d44d4ee..5cdd96ef 100644 --- a/tanh.json +++ b/tanh.json @@ -18,14 +18,14 @@ } ], "returns": { - "description": "The computed hyperbolic tangent of `x`.", + "description": "The computed hyperbolic tangent in the range *(-1, 1)*.", "schema": { "type": [ "number", "null" ], - "minimum": -1, - "maximum": 1 + "minimumExclusive": -1, + "maximumExclusive": 1 } }, "examples": [ From 723c74cb7bfaa347e0645c89f7e9ef2c4c782a05 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 27 Oct 2023 12:11:52 +0200 Subject: [PATCH 4/6] Fix issues reported in code review --- arcosh.json | 4 ++-- arsinh.json | 6 +++--- artanh.json | 9 +++++++-- cosh.json | 4 ++-- sinh.json | 4 ++-- tan.json | 7 ++++++- tanh.json | 4 ++-- 7 files changed, 24 insertions(+), 14 deletions(-) diff --git a/arcosh.json b/arcosh.json index ee43e3f9..820b8cd4 100644 --- a/arcosh.json +++ b/arcosh.json @@ -1,7 +1,7 @@ { "id": "arcosh", "summary": "Inverse hyperbolic cosine", - "description": "Computes the inverse hyperbolic cosine of `x`. It is the inverse function of the hyperbolic cosine so that *`arcosh(cosh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range.", + "description": "Computes the inverse hyperbolic cosine of `x`. It is the inverse function of the hyperbolic cosine so that *`arcosh(cosh(x)) = x`*.\n\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range.", "categories": [ "math > trigonometric" ], @@ -19,7 +19,7 @@ } ], "returns": { - "description": "The computed angle in radians in the range *[0, +∞)*.", + "description": "The computed hyperbolic angle in radians in the range *[0, +∞)*.", "schema": { "type": [ "number", diff --git a/arsinh.json b/arsinh.json index 37384dcd..2b7942dd 100644 --- a/arsinh.json +++ b/arsinh.json @@ -1,7 +1,7 @@ { "id": "arsinh", "summary": "Inverse hyperbolic sine", - "description": "Computes the inverse hyperbolic sine of `x`. It is the inverse function of the hyperbolic sine so that *`arsinh(sinh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the inverse hyperbolic sine of `x`. It is the inverse function of the hyperbolic sine so that *`arsinh(sinh(x)) = x`*.\n\nThe no-data value `null` is passed through and therefore gets propagated.", "categories": [ "math > trigonometric" ], @@ -18,7 +18,7 @@ } ], "returns": { - "description": "The computed angle in radians.", + "description": "The computed hyperbolic angle in radians.", "schema": { "type": [ "number", @@ -41,4 +41,4 @@ "title": "Inverse hyperbolic sine explained by Wolfram MathWorld" } ] -} \ No newline at end of file +} diff --git a/artanh.json b/artanh.json index 38c0a65f..6308290d 100644 --- a/artanh.json +++ b/artanh.json @@ -1,7 +1,7 @@ { "id": "artanh", "summary": "Inverse hyperbolic tangent", - "description": "Computes the inverse hyperbolic tangent of `x`. It is the inverse function of the hyperbolic tangent so that *`artanh(tanh(x)) = x`*.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range.", + "description": "Computes the inverse hyperbolic tangent of `x`. It is the inverse function of the hyperbolic tangent so that *`artanh(tanh(x)) = x`*.\n\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values outside of the allowed range. The computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, `x` = 1 results in +infinity and `x` = 0 results in -infinity. Otherwise, an exception is thrown.", "categories": [ "math > trigonometric" ], @@ -20,7 +20,7 @@ } ], "returns": { - "description": "The computed angle in radians.", + "description": "The computed hyperbolic angle in radians.", "schema": { "type": [ "number", @@ -41,6 +41,11 @@ "rel": "about", "href": "http://mathworld.wolfram.com/InverseHyperbolicTangent.html", "title": "Inverse hyperbolic tangent explained by Wolfram MathWorld" + }, + { + "rel": "about", + "href": "https://ieeexplore.ieee.org/document/4610935", + "title": "IEEE Standard 754-2008 for Floating-Point Arithmetic" } ] } diff --git a/cosh.json b/cosh.json index 7c3574d7..8b56a222 100644 --- a/cosh.json +++ b/cosh.json @@ -1,14 +1,14 @@ { "id": "cosh", "summary": "Hyperbolic cosine", - "description": "Computes the hyperbolic cosine of `x`.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the hyperbolic cosine of `x`.\n\nThe no-data value `null` is passed through and therefore gets propagated.", "categories": [ "math > trigonometric" ], "parameters": [ { "name": "x", - "description": "An angle in radians.", + "description": "An hyperbolic angle in radians.", "schema": { "type": [ "number", diff --git a/sinh.json b/sinh.json index 026f477d..6eced19c 100644 --- a/sinh.json +++ b/sinh.json @@ -1,14 +1,14 @@ { "id": "sinh", "summary": "Hyperbolic sine", - "description": "Computes the hyperbolic sine of `x`.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the hyperbolic sine of `x`.\n\nThe no-data value `null` is passed through and therefore gets propagated.", "categories": [ "math > trigonometric" ], "parameters": [ { "name": "x", - "description": "An angle in radians.", + "description": "An hyperbolic angle in radians.", "schema": { "type": [ "number", diff --git a/tan.json b/tan.json index d9bd2425..4e4d8979 100644 --- a/tan.json +++ b/tan.json @@ -1,7 +1,7 @@ { "id": "tan", "summary": "Tangent", - "description": "Computes the tangent of `x`. The tangent is defined to be the sine of x divided by the cosine of x.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values where the tangent function is not defined.", + "description": "Computes the tangent of `x`. The tangent is defined to be the sine of x divided by the cosine of x.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values where the tangent function is not defined. The computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`tan(pi()/2 + multipliy(pi(), n))`* with `n` being any integer results in ±infinity. -infinity for negative values passed to `tan`, +infinity otherwise. If the processing environment does not supports it, an exception is thrown.", "categories": [ "math > trigonometric" ], @@ -39,6 +39,11 @@ "rel": "about", "href": "http://mathworld.wolfram.com/Tangent.html", "title": "Tangent explained by Wolfram MathWorld" + }, + { + "rel": "about", + "href": "https://ieeexplore.ieee.org/document/4610935", + "title": "IEEE Standard 754-2008 for Floating-Point Arithmetic" } ] } diff --git a/tanh.json b/tanh.json index 5cdd96ef..a38462c9 100644 --- a/tanh.json +++ b/tanh.json @@ -1,14 +1,14 @@ { "id": "tanh", "summary": "Hyperbolic tangent", - "description": "Computes the hyperbolic tangent of `x`. The tangent is defined to be the hyperbolic sine of x divided by the hyperbolic cosine of x.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.", + "description": "Computes the hyperbolic tangent of `x`. The tangent is defined to be the hyperbolic sine of x divided by the hyperbolic cosine of x.\n\nThe no-data value `null` is passed through and therefore gets propagated.", "categories": [ "math > trigonometric" ], "parameters": [ { "name": "x", - "description": "An angle in radians.", + "description": "An hyperbolic angle in radians.", "schema": { "type": [ "number", From 77e6be39c6247c0beccb86cd396c414aec860465 Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 27 Oct 2023 12:31:11 +0200 Subject: [PATCH 5/6] Fixed changelog --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 517bd113..07e891fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased / Draft -### Fixed - ### Changed - `clip`: Throw an exception if min > max [#472](https://github.com/Open-EO/openeo-processes/issues/472) From 3061dc82448aec9992ad4ba86dcdf88dc4642dee Mon Sep 17 00:00:00 2001 From: Matthias Mohr Date: Fri, 27 Oct 2023 12:45:52 +0200 Subject: [PATCH 6/6] Remove NaN --- tan.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tan.json b/tan.json index 4e4d8979..6e927ffc 100644 --- a/tan.json +++ b/tan.json @@ -1,7 +1,7 @@ { "id": "tan", "summary": "Tangent", - "description": "Computes the tangent of `x`. The tangent is defined to be the sine of x divided by the cosine of x.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated. `NaN` is returned for values where the tangent function is not defined. The computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`tan(pi()/2 + multipliy(pi(), n))`* with `n` being any integer results in ±infinity. -infinity for negative values passed to `tan`, +infinity otherwise. If the processing environment does not supports it, an exception is thrown.", + "description": "Computes the tangent of `x`. The tangent is defined to be the sine of x divided by the cosine of x.\n\nWorks on radians only.\nThe no-data value `null` is passed through and therefore gets propagated.\n\nThe computations follow [IEEE Standard 754](https://ieeexplore.ieee.org/document/8766229) whenever the processing environment supports it. Therefore, *`tan(pi()/2 + multipliy(pi(), n))`* with `n` being any integer results in ±infinity. -infinity for negative values passed to `tan`, +infinity otherwise. If the processing environment does not supports it, an exception is thrown.", "categories": [ "math > trigonometric" ],