Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Mar 12, 2024
1 parent 3fa9ed4 commit c1c0bd4
Show file tree
Hide file tree
Showing 15 changed files with 732 additions and 34 deletions.
71 changes: 37 additions & 34 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,28 @@ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

* Cephes <http://www.netlib.org/cephes/readme>

Copyright (c) 1984-2000 Stephen L. Moshier

Some software in this archive may be from the book _Methods and Programs for
Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989)
or from the Cephes Mathematical Library, a commercial product. In either event,
it is copyrighted by the author. What you see here may be used freely but it
comes with no support or guarantee.

Stephen L. Moshier
[email protected]

* FreeBSD <https://svnweb.freebsd.org/>

Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.

Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.

* Go <https://raw.githubusercontent.com/golang/go/master/LICENSE>

Copyright (c) 2009 The Go Authors. All rights reserved.
Expand Down Expand Up @@ -237,28 +259,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

* Cephes <http://www.netlib.org/cephes/readme>

Copyright (c) 1984-2000 Stephen L. Moshier

Some software in this archive may be from the book _Methods and Programs for
Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989)
or from the Cephes Mathematical Library, a commercial product. In either event,
it is copyrighted by the author. What you see here may be used freely but it
comes with no support or guarantee.

Stephen L. Moshier
[email protected]

* FreeBSD <https://svnweb.freebsd.org/>

Copyright (C) 1993-2004 by Sun Microsystems, Inc. All rights reserved.

Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.

* Faddeeva <http://ab-initio.mit.edu/wiki/index.php/Faddeeva_Package#License>

Copyright (c) 2012 Massachusetts Institute of Technology
Expand All @@ -282,18 +282,13 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

* SLATEC Common Mathematical Library <http://www.netlib.no/netlib/slatec/>

Public domain.

* FDLIBM <http://www.netlib.org/fdlibm/>

Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.

Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -325,3 +320,11 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

* SLATEC Common Mathematical Library <http://www.netlib.no/netlib/slatec/>

Public domain.

* FDLIBM <http://www.netlib.org/fdlibm/>

Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.

104 changes: 104 additions & 0 deletions base/special/asecd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<!--
@license Apache-2.0
Copyright (c) 2024 The Stdlib Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# asecd

> Compute the [arcsecant][arcsecant] (in degrees) of a double-precision floating-point number.
<section class="usage">

## Usage

```javascript
var asecd = require( '@stdlib/math/base/special/asecd' );
```

#### asecd( x )

Computes the [arcsecant][arcsecant] (in degrees) of a double-precision floating-point number.

```javascript
var sqrt = require( '@stdlib/math/base/special/sqrt' );
var v = asecd( 1 );
// returns 0.0

v = asecd( 2 * sqrt( 3 ) / 3 );
// returns ~30.0

v = asecd( sqrt( 2 ) );
// returns ~45.0

v = asecd( 2 );
// returns ~60.0

v = asecd( Infinity );
// returns 90.0

v = asecd( NaN );
// returns NaN
```

</section>

<!-- /.usage -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

```javascript
var linspace = require( '@stdlib/array/base/linspace' );
var asecd = require( '@stdlib/math/base/special/asecd' );

var x = linspace( -1.0, 1.0, 100 );

var i;
for ( i = 0; i < x.length; i++ ) {
console.log( asecd( x[ i ] ) );
}
```

</section>

<!-- /.examples -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[arcsecant]: https://en.wikipedia.org/wiki/Inverse_trigonometric_functions

<!-- <related-links> -->

<!-- </related-links> -->

</section>

<!-- /.links -->
51 changes: 51 additions & 0 deletions base/special/asecd/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var randu = require( '@stdlib/random/base/randu' );
var isnan = require( './../../../../base/assert/is-nan' );
var pkg = require( './../package.json' ).name;
var asecd = require( './../lib' );


// MAIN //

bench( pkg, function benchmark( b ) {
var x;
var y;
var i;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
x = ( randu()*2.0 ) + 1.0;
y = asecd( x );
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
if ( isnan( y ) ) {
b.fail( 'should not return NaN' );
}
b.pass( 'benchmark finished' );
b.end();
});
29 changes: 29 additions & 0 deletions base/special/asecd/docs/repl.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

{{alias}}( x )
Computes the arcsecant (in degrees) of a double-precision floating-point
number.

If `x` does not satisy `x >= 1` or `x <= -1`, the function returns NaN.

Parameters
----------
x: number
Input value.

Returns
-------
y: number
Arcsecant (in degrees).

Examples
--------
> var y = {{alias}}( 0.0 )
NaN
> y = {{alias}}( 2 )
~60.0
> y = {{alias}}( NaN )
NaN

See Also
--------

56 changes: 56 additions & 0 deletions base/special/asecd/docs/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// TypeScript Version: 4.1

/**
* Computes the arcsecant (in degrees) of a double-precision floating-point number.
*
* @param x - input value
* @returns arcsecant (in degrees)
*
* @example
* var v = asecd( 1 );
* // returns 0.0
*
* @example
* var v = asecd( 2 * Math.sqrt( 3 ) / 3 );
* // returns ~30.0
*
* @example
* var v = asecd( Math.sqrt( 2 ) );
* // returns ~45.0
*
* @example
* var v = asecd( 2 );
* // returns ~60.0
*
* @example
* var v = asecd( Infinity );
* // returns 90.0
*
* @example
* var v = asecd( NaN );
* // returns NaN
*/
declare function asecd( x: number ): number;


// EXPORTS //

export = asecd;
44 changes: 44 additions & 0 deletions base/special/asecd/docs/types/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import asecd = require( './index' );


// TESTS //

// The function returns a number...
{
asecd( 1.2 ); // $ExpectType number
}

// The compiler throws an error if the function is provided a value other than a number...
{
asecd( true ); // $ExpectError
asecd( false ); // $ExpectError
asecd( null ); // $ExpectError
asecd( undefined ); // $ExpectError
asecd( '5' ); // $ExpectError
asecd( [] ); // $ExpectError
asecd( {} ); // $ExpectError
asecd( ( x: number ): number => x ); // $ExpectError
}

// The compiler throws an error if the function is provided insufficient arguments...
{
asecd(); // $ExpectError
}
Loading

0 comments on commit c1c0bd4

Please sign in to comment.