Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add JS implementation for math/base/special/sicif #7746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
anandkaranubc wants to merge 2 commits into stdlib-js:develop
base: develop
Choose a base branch
Loading
from anandkaranubc:feat/sicif

Conversation

Copy link
Contributor

@anandkaranubc anandkaranubc commented Jul 26, 2025

Progresses #649

Description

What is the purpose of this pull request?

This pull request:

  • Adds the JS implementation for math/base/special/sicif

Related Issues

Does this pull request have any related issues?

This pull request:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

---
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: passed
 - task: lint_javascript_tests
 status: passed
 - task: lint_javascript_benchmarks
 status: passed
 - task: lint_python
 status: passed
 - task: lint_r
 status: na
 - task: lint_c_src
 status: na
 - task: lint_c_examples
 status: na
 - task: lint_c_benchmarks
 status: passed
 - task: lint_c_tests_fixtures
 status: na
 - task: lint_shell
 status: na
 - task: lint_typescript_declarations
 status: passed
 - task: lint_typescript_tests
 status: passed
 - task: lint_license_headers
 status: passed
---
@stdlib-bot stdlib-bot added Math Issue or pull request specific to math functionality. Needs Review A pull request which needs code review. labels Jul 26, 2025
@anandkaranubc anandkaranubc added Feature Issue or pull request for adding a new feature. JavaScript Issue involves or relates to JavaScript. GSoC Google Summer of Code. gsoc: 2025 Google Summer of Code (2025). labels Jul 26, 2025
Copy link
Contributor Author

Copy link
Contributor

Coverage Report

Package Statements Branches Functions Lines
math/base/special/sicif $\color{red}921/945$
$\color{green}+97.46\%$
$\color{red}48/60$
$\color{green}+80.00\%$
$\color{green}14/14$
$\color{green}+100.00\%$
$\color{red}921/945$
$\color{green}+97.46\%$

The above coverage report was generated for the changes in this PR.

v = sicif( x[ i ] );

t.strictEqual( ulpdiff( v[ 0 ], si[ i ] ) <= 3, true, 'returns expected value within 3 ulp' );
t.strictEqual( ulpdiff( v[ 1 ], ci[ i ] ) <= 1006, true, 'returns expected value within 1006 ulp' );
Copy link
Contributor Author

@anandkaranubc anandkaranubc Jul 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I am still a little unclear why this difference is higher than others. I checked the implementation multiple times and the block that gets triggered through this test suite, seems all ok to me. Can I get some guidance on this please?

Comment on lines +160 to +179
if ( x > FOUR ) {
s = sinf( x );
c = cosf( x );
z = f32( ONE / f32( x*x ) );
if ( x < EIGHT ) {
f = f32( polyvalFN4( z ) / f32( x * polyvalFD4( z ) ) );
g = f32( f32( z * polyvalGN4( z ) ) / polyvalGD4( z ) );
} else {
f = f32( polyvalFN8( z ) / f32( x * polyvalFD8( z ) ) );
g = f32( f32( z * polyvalGN8( z ) ) / polyvalGD8( z ) );
}
si = f32( f32( HALF_PI - f32( f*c ) ) - f32( g*s ) );
if ( sgn ) {
si = f32( -si );
}
ci = f32( f32( f*s ) - f32( g*c ) );
out[ offset ] = si;
out[ offset + stride ] = ci;
return out;
}
Copy link
Contributor Author

@anandkaranubc anandkaranubc Jul 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the block. I also can confirm that the operator precedence and order is correctly followed too...

According to C rules.

Copy link
Contributor Author

@anandkaranubc anandkaranubc Jul 26, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reference code block:

s = sinf(x);
c = cosf(x);
z = 1.0/(x*x);
if( x < 8.0 )
	{
	f = polevlf( z, FN4, 6 ) / (x * p1evlf( z, FD4, 7 ));
	g = z * polevlf( z, GN4, 7 ) / p1evlf( z, GD4, 7 );
	}
else
	{
	f = polevlf( z, FN8, 8 ) / (x * p1evlf( z, FD8, 8 ));
	g = z * polevlf( z, GN8, 8 ) / p1evlf( z, GD8, 9 );
	}
*si = PIO2F - f * c - g * s;
if( sign )
	*si = -( *si );
*ci = f * s - g * c;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@Planeshifter Planeshifter Awaiting requested review from Planeshifter

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Labels
Feature Issue or pull request for adding a new feature. GSoC Google Summer of Code. gsoc: 2025 Google Summer of Code (2025). JavaScript Issue involves or relates to JavaScript. Math Issue or pull request specific to math functionality. Needs Review A pull request which needs code review.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /