Skip to content

Commit 46d0f11

Browse files
chore: changes as per code review
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: passed - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 669c44c commit 46d0f11

File tree

9 files changed

+11
-284
lines changed

9 files changed

+11
-284
lines changed

lib/node_modules/@stdlib/math/base/special/log1pf/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# log1pf
2222

23-
> Evaluate the [natural logarithm][@stdlib/math/base/special/ln] of `1+x` in single‐precision floating-point number.
23+
> Evaluate the [natural logarithm][@stdlib/math/base/special/ln] of `1+x` as a single‐precision floating-point number.
2424
2525
<section class="usage">
2626

@@ -32,7 +32,7 @@ var log1pf = require( '@stdlib/math/base/special/log1pf' );
3232

3333
#### log1pf( x )
3434

35-
Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of `1+x` in single‐precision floating-point number.
35+
Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of `1+x` as a single‐precision floating-point number.
3636

3737
```javascript
3838
var v = log1pf( 4.0 );
@@ -117,7 +117,7 @@ for ( i = 0; i < 100; i++ ) {
117117

118118
#### stdlib_base_log1pf( x )
119119

120-
Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of `1+x` in single‐precision floating-point number.
120+
Evaluates the [natural logarithm][@stdlib/math/base/special/ln] of `1+x` as a single‐precision floating-point number.
121121

122122
```c
123123
float out = stdlib_base_log1pf( 4.0f );

lib/node_modules/@stdlib/math/base/special/log1pf/docs/repl.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
{{alias}}( x )
3-
Evaluates the natural logarithm of `1+x`.
3+
Evaluates the natural logarithm of `1+x` as a single‐precision
4+
floating-point number.
45

56
For `x < -1`, the function returns `NaN`, as the natural logarithm is not
67
defined for negative numbers.

lib/node_modules/@stdlib/math/base/special/log1pf/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// TypeScript Version: 4.1
2020

2121
/**
22-
* Evaluates the natural logarithm of `1+x`.
22+
* Evaluates the natural logarithm of `1+x` as a single‐precision floating-point number.
2323
*
2424
* ## Notes
2525
*

lib/node_modules/@stdlib/math/base/special/log1pf/include/stdlib/math/base/special/log1pf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C" {
2727
#endif
2828

2929
/**
30-
Evaluates the natural logarithm of `1+x` in single‐precision floating-point number.
30+
Evaluates the natural logarithm of `1+x` as a single‐precision floating-point number.
3131
*/
3232
float stdlib_base_log1pf( const float x );
3333

lib/node_modules/@stdlib/math/base/special/log1pf/lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'use strict';
2020

2121
/**
22-
* Evaluate the natural logarithm of \\(1+x\\) in single‐precision floating-point number.
22+
* Evaluate the natural logarithm of \\(1+x\\) as a single‐precision floating-point number.
2323
*
2424
* @module @stdlib/math/base/special/log1pf
2525
*

lib/node_modules/@stdlib/math/base/special/log1pf/lib/main.js

Lines changed: 0 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -73,142 +73,6 @@ var TWO_THIRDS = 6.666666666e-01;
7373
/**
7474
* Evaluates the natural logarithm of \\(1+x\\) as a single‐precision floating-point number.
7575
*
76-
* ## Method
77-
*
78-
* 1. Argument Reduction: find \\(k\\) and \\(f\\) such that
79-
*
80-
* ```tex
81-
* 1+x = 2^k (1+f)
82-
* ```
83-
*
84-
* where
85-
*
86-
* ```tex
87-
* \frac{\sqrt{2}}{2} < 1+f < \sqrt{2}
88-
* ```
89-
*
90-
* <!-- <note> -->
91-
*
92-
* If \\(k=0\\), then \\(f=x\\) is exact. However, if \\(k \neq 0\\), then \\(f\\) may not be representable exactly. In that case, a correction term is needed. Let
93-
*
94-
* ```tex
95-
* u = \operatorname{round}(1+x)
96-
* ```
97-
*
98-
* and
99-
*
100-
* ```tex
101-
* c = (1+x) - u
102-
* ```
103-
*
104-
* then
105-
*
106-
* ```tex
107-
* \ln (1+x) - \ln u \approx \frac{c}{u}
108-
* ```
109-
*
110-
* We can thus proceed to compute \\(\ln(u)\\), and add back the correction term \\(c/u\\).
111-
*
112-
* <!-- </note> -->
113-
*
114-
* <!-- <note> -->
115-
*
116-
* When \\(x > 2^{24}\\), one can simply return \\(\ln(x)\\).
117-
*
118-
* <!-- </note> -->
119-
*
120-
* 2. Approximation of \\(\operatorname{log1pf}(f)\\). Let
121-
*
122-
* ```tex
123-
* s = \frac{f}{2+f}
124-
* ```
125-
*
126-
* based on
127-
*
128-
* ```tex
129-
* \begin{align*}
130-
* \ln 1+f &= \ln (1+s) - \lnf (1-s) \\
131-
* &= 2s + \frac{2}{3} s^3 + \frac{2}{5} s^5 + ... \\
132-
* &= 2s + sR \\
133-
* \end{align*}
134-
* ```
135-
*
136-
* We use a special Reme algorithm on \\(\[0,0.1716\]\\) to generate a polynomial of degree \\(14\\) to approximate \\(R\\). The maximum error of this polynomial approximation is bounded by \\(2^{-58.45}\\). In other words,
137-
*
138-
* ```tex
139-
* R(z) \approx \mathrm{Lp}_1 s^2 + \mathrm{Lp}_2 s^4 + \mathrm{Lp}_3 s^6 + \mathrm{Lp}_4 s^8 + \mathrm{Lp}_5 s^{10} + \mathrm{Lp}_6 s^{12} + \mathrm{Lp}_7 s^{14}
140-
* ```
141-
*
142-
* and
143-
*
144-
* ```tex
145-
* | \mathrm{Lp}_1 s^2 + \ldots + \mathrm{Lp}_7 s^14 - R(z) | \leq 2^{-58.45}
146-
* ```
147-
*
148-
* <!-- <note> -->
149-
*
150-
* The values of \\(Lp1\\) to \\(Lp7\\) may be found in the source.
151-
*
152-
* <!-- </note> -->
153-
*
154-
* Note that
155-
*
156-
* ```tex
157-
* \begin{align*}
158-
* 2s &= f - sf \\
159-
* &= f - \frac{f^2}{2} + s \frac{f^2}{2} \\
160-
* \end{align*}
161-
* ```
162-
*
163-
* In order to guarantee error in \\(\ln\\) below \\(1\ \mathrm{ulp}\\), we compute the log by
164-
*
165-
* ```tex
166-
* \operatorname{log1pf}(f) = f - \biggl(\frac{f^2}{2} - s\biggl(\frac{f^2}{2}+R\biggr)\biggr)
167-
* ```
168-
*
169-
* 3. Finally,
170-
*
171-
* ```tex
172-
* \begin{align*}
173-
* \operatorname{log1pf}(x) &= k \cdot \mathrm{ln2} + \operatorname{log1pf}(f) \\
174-
* &= k \cdot \mathrm{ln2}_{hi}+\biggl(f-\biggl(\frac{f^2}{2}-\biggl(s\biggl(\frac{f^2}{2}+R\biggr)+k \cdot \mathrm{ln2}_{lo}\biggr)\biggr)\biggr) \\
175-
* \end{align*}
176-
* ```
177-
*
178-
* Here \\(\mathrm{ln2}\\) is split into two floating point numbers:
179-
*
180-
* ```tex
181-
* \mathrm{ln2}_{hi} + \mathrm{ln2}_{lo}
182-
* ```
183-
*
184-
* where \\(n \cdot \mathrm{ln2}_{hi}\\) is always exact for \\(|n| < 2000\\).
185-
*
186-
* ## Special Cases
187-
*
188-
* - \\(\operatorname{log1pf}(x) = \mathrm{NaN}\\) with signal if \\(x < -1\\) (including \\(-\infty\\))
189-
* - \\(\operatorname{log1pf}(+\infty) = +\infty\\)
190-
* - \\(\operatorname{log1pf}(-1) = -\infty\\) with signal
191-
* - \\(\operatorname{log1pf}(\mathrm{NaN})= \mathrm{NaN}\\) with no signal
192-
*
193-
* ## Notes
194-
*
195-
* - According to an error analysis, the error is always less than \\(1\\) ulp (unit in the last place).
196-
*
197-
* - The hexadecimal values are the intended ones for the used constants. The decimal values may be used, provided that the compiler will convert from decimal to binary accurately enough to produce the hexadecimal values shown.
198-
*
199-
* - Assuming \\(\ln(x)\\) is accurate, the following algorithm can be used to evaluate \\(\operatorname{log1pf}(x)\\) to within a few ULP:
200-
*
201-
* ```javascript
202-
* var u = 1.0 + x;
203-
* if ( u === 1.0 ) {
204-
* return x;
205-
* } else {
206-
* return ln(u) * (x/(u-1.0));
207-
* }
208-
* ```
209-
*
210-
* See HP-15C Advanced Functions Handbook, p.193.
211-
*
21276
* @param {number} x - input value
21377
* @returns {number} the natural logarithm of `1+x`
21478
*

lib/node_modules/@stdlib/math/base/special/log1pf/lib/native.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var addon = require( './../src/addon.node' );
2626
// MAIN //
2727

2828
/**
29-
* Evaluates the natural logarithm of \\(1+x\\) in single‐precision floating-point number.
29+
* Evaluates the natural logarithm of \\(1+x\\) as a single‐precision floating-point number.
3030
*
3131
* @private
3232
* @param {number} x - input value

lib/node_modules/@stdlib/math/base/special/log1pf/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stdlib/math/base/special/log1pf",
33
"version": "0.0.0",
4-
"description": "Evaluate the natural logarithm of 1+x in single‐precision.",
4+
"description": "Evaluate the natural logarithm of 1+x as a single‐precision.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "The Stdlib Authors",

lib/node_modules/@stdlib/math/base/special/log1pf/src/main.c

Lines changed: 1 addition & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -86,145 +86,7 @@ static float polyval_lp( const float x ) {
8686
/* End auto-generated functions. */
8787

8888
/**
89-
* Evaluates the natural logarithm of \\(1+x\\) in single‐precision floating-point number.
90-
*
91-
* ## Method
92-
*
93-
* 1. Argument Reduction: find \\(k\\) and \\(f\\) such that
94-
*
95-
* ```tex
96-
* 1+x = 2^k (1+f)
97-
* ```
98-
*
99-
* where
100-
*
101-
* ```tex
102-
* \frac{\sqrt{2}}{2} < 1+f < \sqrt{2}
103-
* ```
104-
*
105-
* <!-- <note> -->
106-
*
107-
* If \\(k=0\\), then \\(f=x\\) is exact. However, if \\(k \neq 0\\), then \\(f\\) may not be representable exactly. In that case, a correction term is needed. Let
108-
*
109-
* ```tex
110-
* u = \operatorname{round}(1+x)
111-
* ```
112-
*
113-
* and
114-
*
115-
* ```tex
116-
* c = (1+x) - u
117-
* ```
118-
*
119-
* then
120-
*
121-
* ```tex
122-
* \ln (1+x) - \ln u \approx \frac{c}{u}
123-
* ```
124-
*
125-
* We can thus proceed to compute \\(\ln(u)\\), and add back the correction term \\(c/u\\).
126-
*
127-
* <!-- </note> -->
128-
*
129-
* <!-- <note> -->
130-
*
131-
* When \\(x > 2^{53}\\), one can simply return \\(\ln(x)\\).
132-
*
133-
* <!-- </note> -->
134-
*
135-
* 2. Approximation of \\(\operatorname{log1pf}(f)\\). Let
136-
*
137-
* ```tex
138-
* s = \frac{f}{2+f}
139-
* ```
140-
*
141-
* based on
142-
*
143-
* ```tex
144-
* \begin{align*}
145-
* \ln 1+f &= \ln (1+s) - \ln (1-s) \\
146-
* &= 2s + \frac{2}{3} s^3 + \frac{2}{5} s^5 + ... \\
147-
* &= 2s + sR \\
148-
* \end{align*}
149-
* ```
150-
*
151-
* We use a special Reme algorithm on \\(\[0,0.1716\]\\) to generate a polynomial of degree \\(14\\) to approximate \\(R\\). The maximum error of this polynomial approximation is bounded by \\(2^{-58.45}\\). In other words,
152-
*
153-
* ```tex
154-
* R(z) \approx \mathrm{Lp}_1 s^2 + \mathrm{Lp}_2 s^4 + \mathrm{Lp}_3 s^6 + \mathrm{Lp}_4 s^8 + \mathrm{Lp}_5 s^{10} + \mathrm{Lp}_6 s^{12} + \mathrm{Lp}_7 s^{14}
155-
* ```
156-
*
157-
* and
158-
*
159-
* ```tex
160-
* | \mathrm{Lp}_1 s^2 + \ldots + \mathrm{Lp}_7 s^14 - R(z) | \leq 2^{-58.45}
161-
* ```
162-
*
163-
* <!-- <note> -->
164-
*
165-
* The values of \\(Lp1\\) to \\(Lp7\\) may be found in the source.
166-
*
167-
* <!-- </note> -->
168-
*
169-
* Note that
170-
*
171-
* ```tex
172-
* \begin{align*}
173-
* 2s &= f - sf \\
174-
* &= f - \frac{f^2}{2} + s \frac{f^2}{2} \\
175-
* \end{align*}
176-
* ```
177-
*
178-
* In order to guarantee error in \\(\ln\\) below \\(1\ \mathrm{ulp}\\), we compute the log by
179-
*
180-
* ```tex
181-
* \operatorname{log1pf}(f) = f - \biggl(\frac{f^2}{2} - s\biggl(\frac{f^2}{2}+R\biggr)\biggr)
182-
* ```
183-
*
184-
* 3. Finally,
185-
*
186-
* ```tex
187-
* \begin{align*}
188-
* \operatorname{log1pf}(x) &= k \cdot \mathrm{ln2} + \operatorname{log1pf}(f) \\
189-
* &= k \cdot \mathrm{ln2}_{hi}+\biggl(f-\biggl(\frac{f^2}{2}-\biggl(s\biggl(\frac{f^2}{2}+R\biggr)+k \cdot \mathrm{ln2}_{lo}\biggr)\biggr)\biggr) \\
190-
* \end{align*}
191-
* ```
192-
*
193-
* Here \\(\mathrm{ln2}\\) is split into two floating point numbers:
194-
*
195-
* ```tex
196-
* \mathrm{ln2}_{hi} + \mathrm{ln2}_{lo}
197-
* ```
198-
*
199-
* where \\(n \cdot \mathrm{ln2}_{hi}\\) is always exact for \\(|n| < 2000\\).
200-
*
201-
*
202-
* ## Special Cases
203-
*
204-
* - \\(\operatorname{log1pf}(x) = \mathrm{NaN}\\) with signal if \\(x < -1\\) (including \\(-\infty\\))
205-
* - \\(\operatorname{log1pf}(+\infty) = +\infty\\)
206-
* - \\(\operatorname{log1pf}(-1) = -\infty\\) with signal
207-
* - \\(\operatorname{log1pf}(\mathrm{NaN})= \mathrm{NaN}\\) with no signal
208-
*
209-
*
210-
* ## Notes
211-
*
212-
* - According to an error analysis, the error is always less than \\(1\\) ulp (unit in the last place).
213-
*
214-
* - The hexadecimal values are the intended ones for the used constants. The decimal values may be used, provided that the compiler will convert from decimal to binary accurately enough to produce the hexadecimal values shown.
215-
*
216-
* - Assuming \\(\ln(x)\\) is accurate, the following algorithm can be used to evaluate \\(\operatorname{log1pf}(x)\\) to within a few ULP:
217-
*
218-
* ```c
219-
* double u = 1.0 + x;
220-
* if ( u == 1.0 ) {
221-
* return x;
222-
* } else {
223-
* return ln(u) * (x/(u-1.0));
224-
* }
225-
* ```
226-
*
227-
* See HP-15C Advanced Functions Handbook, p.193.
89+
* Evaluates the natural logarithm of \\(1+x\\) as a single‐precision floating-point number.
22890
*
22991
* @param x input value
23092
* @return output value

0 commit comments

Comments
 (0)