-
-
Notifications
You must be signed in to change notification settings - Fork 834
fix: update math/base/special/secd
to match correct reference implementation
#5810
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
Changes from all commits
35d5e90
270a4d6
e571f69
a0ffce8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ var tape = require( 'tape' ); | |
var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
var abs = require( '@stdlib/math/base/special/abs' ); | ||
var EPS = require( '@stdlib/constants/float64/eps' ); | ||
var PINF = require( '@stdlib/constants/float64/pinf' ); | ||
var secd = require( './../lib' ); | ||
|
||
|
||
|
@@ -58,7 +59,7 @@ tape( 'the function computes the secant of an angle measured in degrees (negativ | |
t.equal( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); | ||
} else { | ||
delta = abs( y - expected[i] ); | ||
tol = EPS * abs( expected[i] ); | ||
tol = 1.4 * EPS * abs( expected[i] ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tolerance had to be increased slightly from |
||
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); | ||
} | ||
} | ||
|
@@ -82,7 +83,7 @@ tape( 'the function computes the secant of an angle measured in degrees (positiv | |
t.equal( y, expected[ i ], 'x: '+x[i]+'. E: '+expected[i] ); | ||
} else { | ||
delta = abs( y - expected[i] ); | ||
tol = EPS * abs( expected[i] ); | ||
tol = 1.4 * EPS * abs( expected[i] ); | ||
t.ok( delta <= tol, 'within tolerance. x: '+x[i]+'. y: '+y+'. E: '+expected[i]+'. tol: '+tol+'. Δ: '+delta+'.' ); | ||
} | ||
} | ||
|
@@ -91,6 +92,18 @@ tape( 'the function computes the secant of an angle measured in degrees (positiv | |
|
||
tape( 'the function returns `NaN` if provided `NaN`', function test( t ) { | ||
var v = secd( NaN ); | ||
t.equal( isnan( v ), true, 'returns NaN' ); | ||
t.equal( isnan( v ), true, 'returns expected value' ); | ||
t.end(); | ||
}); | ||
|
||
tape( 'the function returns `+Infinity` if provided an odd multiple of `90`', function test( t ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also added this test since it was not being checked by the test fixtures. |
||
var v = secd( 90.0 ); | ||
t.equal( v, PINF, 'returns expected value' ); | ||
v = secd( -90.0 ); | ||
t.equal( v, PINF, 'returns expected value' ); | ||
v = secd( 270.0 ); | ||
t.equal( v, PINF, 'returns expected value' ); | ||
v = secd( -270.0 ); | ||
t.equal( v, PINF, 'returns expected value' ); | ||
t.end(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing over the period of
secd