Skip to content

Commit ff9bbb5

Browse files
committed
docs: refactor examples to use log-each-map
--- 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: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - 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: na - task: lint_c_examples status: passed - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 28b05e8 commit ff9bbb5

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,16 @@ var phi = cphasef( new Complex64( 5.0, 3.0 ) );
6060
<!-- eslint no-undef: "error" -->
6161

6262
```javascript
63-
var Complex64 = require( '@stdlib/complex/float32/ctor' );
64-
var uniform = require( '@stdlib/random/base/uniform' );
63+
var Complex64Array = require( '@stdlib/array/complex64' );
64+
var uniform = require( '@stdlib/random/array/uniform' );
65+
var logEachMap = require( '@stdlib/console/log-each-map' );
6566
var cphasef = require( '@stdlib/math/base/special/cphasef' );
6667

67-
var z;
68-
var i;
68+
// Create an array of random numbers:
69+
var arr = new Complex64Array( uniform( 200, -100.0, 100.0 ) );
6970

70-
for ( i = 0; i < 100; i++ ) {
71-
z = new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) );
72-
console.log( 'arg(%s) = %d', z.toString(), cphasef( z ) );
73-
}
71+
// Compute the inverse of each number in the array:
72+
logEachMap( 'cphasef(%s) = %0.4f', arr, cphasef );
7473
```
7574

7675
</section>
@@ -166,7 +165,7 @@ int main( void ) {
166165
v = x[ i ];
167166
y = stdlib_base_cphasef( v );
168167
stdlib_complex64_reim( v, &re, &im );
169-
printf( "fcphasef(%f + %fi) = %f\n", re, im, y );
168+
printf( "cphasef(%f + %fi) = %f\n", re, im, y );
170169
}
171170
}
172171
```

lib/node_modules/@stdlib/math/base/special/cphasef/examples/c/example.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ int main( void ) {
3838
v = x[ i ];
3939
y = stdlib_base_cphasef( v );
4040
stdlib_complex64_reim( v, &re, &im );
41-
printf( "fcphasef(%f + %fi) = %f\n", re, im, y );
41+
printf( "cphasef(%f + %fi) = %f\n", re, im, y );
4242
}
4343
}

lib/node_modules/@stdlib/math/base/special/cphasef/examples/index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818

1919
'use strict';
2020

21-
var Complex64 = require( '@stdlib/complex/float32/ctor' );
22-
var uniform = require( '@stdlib/random/base/uniform' );
21+
var Complex64Array = require( '@stdlib/array/complex64' );
22+
var uniform = require( '@stdlib/random/array/uniform' );
23+
var logEachMap = require( '@stdlib/console/log-each-map' );
2324
var cphasef = require( './../lib' );
2425

25-
var z;
26-
var i;
26+
// Create an array of random numbers:
27+
var arr = new Complex64Array( uniform( 200, -100.0, 100.0 ) );
2728

28-
for ( i = 0; i < 100; i++ ) {
29-
z = new Complex64( uniform( -500.0, 500.0 ), uniform( -500.0, 500.0 ) );
30-
console.log( 'arg(%s) = %d', z.toString(), cphasef( z ) );
31-
}
29+
// Compute the inverse of each number in the array:
30+
logEachMap( 'cphasef(%s) = %0.4f', arr, cphasef );

0 commit comments

Comments
 (0)