Skip to content
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

refactor: update math/base/special/atanh according to the FreeBSD implementation #3128

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Copy link
Member

Choose a reason for hiding this comment

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

@RiyaChy072 I don't think we need to change these fixtures for this. Was there any specific reason to update them?

Copy link
Author

Choose a reason for hiding this comment

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

@gunjjoshi I thought that needed to be done, didn't know we don't need that

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions lib/node_modules/@stdlib/math/base/special/atanh/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ double stdlib_base_atanh( const double x ) {
int32_t sgn;
double ax;
double t;
if ( stdlib_base_is_nan( x ) || x < -1.0 || x > 1.0 ) {
return 0.0 / 0.0; // NaN
}
if ( x == 1.0 ) {
return STDLIB_CONSTANT_FLOAT64_PINF;

if( ax > 1 || stdlib_base_is_nan( x ) ) { // |x|>1 or x is NaN
return 0.0 / 0.0 ; //NaN
}
if ( x == -1.0 ) {
return STDLIB_CONSTANT_FLOAT64_NINF;

if( ax == 1 ) { // |x| == 1
return (sgn > 0) ? STDLIB_CONSTANT_FLOAT64_NINF : STDLIB_CONSTANT_FLOAT64_PINF;
}

Comment on lines +85 to +93
Copy link
Member

Choose a reason for hiding this comment

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

@RiyaChy072 This isn't what we need to do here. As mentioned previously, we need to use various stdlib utilities here, similar to how they are being used in the FreeBSD reference implementation.

Copy link
Author

Choose a reason for hiding this comment

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

@gunjjoshi Can i use HIGH_WORD_ABS_MASK here?

if ( x < 0.0 ) {
sgn = 1;
ax = -x;
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading