Skip to content

Commit 56ddb18

Browse files
committed
chore: remove xRad for cleaner code
--- 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: na - task: lint_package_json status: na - task: lint_repl_help status: na - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent 0b4bf46 commit 56ddb18

File tree

2 files changed

+10
-22
lines changed
  • lib/node_modules/@stdlib/math/base/special/cosd

2 files changed

+10
-22
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ var isInfinite = require( '@stdlib/math/base/assert/is-infinite' );
5454
* // returns NaN
5555
*/
5656
function cosd( x ) {
57-
var xRad;
5857
var rx;
5958

6059
if (
@@ -67,23 +66,18 @@ function cosd( x ) {
6766
rx = abs( fmod( x, 360.0 ) );
6867

6968
if ( rx <= 45.0 ) {
70-
xRad = deg2rad( rx );
71-
return kernelCos( xRad, 0.0 );
69+
return kernelCos( deg2rad( rx ), 0.0 );
7270
}
7371
if ( rx < 135.0 ) {
74-
xRad = deg2rad( 90.0-rx );
75-
return kernelSin( xRad, 0.0 );
72+
return kernelSin( deg2rad( 90.0-rx ), 0.0 );
7673
}
7774
if ( rx <= 225.0 ) {
78-
xRad = deg2rad( 180.0-rx );
79-
return -kernelCos( xRad, 0.0 );
75+
return -kernelCos( deg2rad( 180.0-rx ), 0.0 );
8076
}
8177
if ( rx < 315.0 ) {
82-
xRad = deg2rad( rx-270.0 );
83-
return kernelSin( xRad, 0.0 );
78+
return kernelSin( deg2rad( rx-270.0 ), 0.0 );
8479
}
85-
xRad = deg2rad( 360.0-rx );
86-
return kernelCos( xRad, 0.0 );
80+
return kernelCos( deg2rad( 360.0-rx ), 0.0 );
8781
}
8882

8983

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
* // returns 1.0
3737
*/
3838
double stdlib_base_cosd( const double x ) {
39-
double xRad;
4039
double rx;
4140

4241
if ( stdlib_base_is_infinite( x ) || stdlib_base_is_nan( x ) ) {
@@ -46,21 +45,16 @@ double stdlib_base_cosd( const double x ) {
4645
rx = stdlib_base_abs( stdlib_base_fmod( x, 360.0 ) );
4746

4847
if ( rx <= 45.0 ) {
49-
xRad = stdlib_base_deg2rad( rx );
50-
return stdlib_base_kernel_cos( xRad, 0.0 );
48+
return stdlib_base_kernel_cos( stdlib_base_deg2rad( rx ), 0.0 );
5149
}
5250
if ( rx < 135.0 ) {
53-
xRad = stdlib_base_deg2rad( 90.0-rx );
54-
return stdlib_base_kernel_sin( xRad, 0.0 );
51+
return stdlib_base_kernel_sin( stdlib_base_deg2rad( 90.0-rx ), 0.0 );
5552
}
5653
if ( rx <= 225.0 ) {
57-
xRad = stdlib_base_deg2rad( 180.0-rx );
58-
return -stdlib_base_kernel_cos( xRad, 0.0 );
54+
return -stdlib_base_kernel_cos( stdlib_base_deg2rad( 180.0-rx ), 0.0 );
5955
}
6056
if ( rx < 315.0 ) {
61-
xRad = stdlib_base_deg2rad( rx-270.0 );
62-
return stdlib_base_kernel_sin( xRad, 0.0 );
57+
return stdlib_base_kernel_sin( stdlib_base_deg2rad( rx-270.0 ), 0.0 );
6358
}
64-
xRad = stdlib_base_deg2rad( 360.0-rx );
65-
return stdlib_base_kernel_cos( xRad, 0.0 );
59+
return stdlib_base_kernel_cos( stdlib_base_deg2rad( 360.0-rx ), 0.0 );
6660
}

0 commit comments

Comments
 (0)