|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2024 The Stdlib Authors. |
| 6 | +
|
| 7 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +you may not use this file except in compliance with the License. |
| 9 | +You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +
|
| 13 | +Unless required by applicable law or agreed to in writing, software |
| 14 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +See the License for the specific language governing permissions and |
| 17 | +limitations under the License. |
| 18 | +
|
| 19 | +--> |
| 20 | + |
| 21 | +# Arccoversinef |
| 22 | + |
| 23 | +> Compute the [inverse coversed sine][inverse-coversed-sine] of a single-precision floating-point number (in radians). |
| 24 | +
|
| 25 | +<section class="intro"> |
| 26 | + |
| 27 | +The [inverse coversed sine][inverse-coversed-sine] is defined as |
| 28 | + |
| 29 | +<!-- <equation class="equation" label="eq:arccoversine" align="center" raw="\operatorname{acoversinf}(\theta) = \arcsin(1-\theta)" alt="Inverse coversed sine."> --> |
| 30 | + |
| 31 | +```math |
| 32 | +\mathop{\mathrm{acoversinf}}(\theta) = \arcsin(1-\theta) |
| 33 | +``` |
| 34 | + |
| 35 | +<!-- </equation> --> |
| 36 | + |
| 37 | +</section> |
| 38 | + |
| 39 | +<!-- /.intro --> |
| 40 | + |
| 41 | +<section class="usage"> |
| 42 | + |
| 43 | +## Usage |
| 44 | + |
| 45 | +```javascript |
| 46 | +var acoversinf = require( '@stdlib/math/base/special/acoversinf' ); |
| 47 | +``` |
| 48 | + |
| 49 | +#### acoversinf( x ) |
| 50 | + |
| 51 | +Computes the [inverse coversed sine][inverse-coversed-sine] of a single-precision floating-point number (in radians). |
| 52 | + |
| 53 | +```javascript |
| 54 | +var v = acoversinf( 0.0 ); |
| 55 | +// returns ~1.5708 |
| 56 | + |
| 57 | +v = acoversinf( 3.141592653589793 / 2.0 ); |
| 58 | +// returns ~-0.6075 |
| 59 | + |
| 60 | +v = acoversinf( 3.141592653589793 / 6.0 ); |
| 61 | +// returns ~0.4966 |
| 62 | +``` |
| 63 | + |
| 64 | +If `x < 0`, `x > 2`, or `x` is `NaN`, the function returns `NaN`. |
| 65 | + |
| 66 | +```javascript |
| 67 | +var v = acoversinf( -1.0 ); |
| 68 | +// returns NaN |
| 69 | + |
| 70 | +v = acoversinf( 3.14 ); |
| 71 | +// returns NaN |
| 72 | + |
| 73 | +v = acoversinf( NaN ); |
| 74 | +// returns NaN |
| 75 | +``` |
| 76 | + |
| 77 | +</section> |
| 78 | + |
| 79 | +<!-- /.usage --> |
| 80 | + |
| 81 | +<section class="examples"> |
| 82 | + |
| 83 | +## Examples |
| 84 | + |
| 85 | +<!-- eslint no-undef: "error" --> |
| 86 | + |
| 87 | +```javascript |
| 88 | +var linspace = require( '@stdlib/array/base/linspace' ); |
| 89 | +var acoversinf = require( '@stdlib/math/base/special/acoversinf' ); |
| 90 | + |
| 91 | +var x = linspace( 0.0, 2.0, 100 ); |
| 92 | + |
| 93 | +var i; |
| 94 | +for ( i = 0; i < x.length; i++ ) { |
| 95 | + console.log( acoversinf( x[ i ] ) ); |
| 96 | +} |
| 97 | +``` |
| 98 | + |
| 99 | +</section> |
| 100 | + |
| 101 | +<!-- /.examples --> |
| 102 | + |
| 103 | +<!-- C interface documentation. --> |
| 104 | + |
| 105 | +* * * |
| 106 | + |
| 107 | +<section class="c"> |
| 108 | + |
| 109 | +## C APIs |
| 110 | + |
| 111 | +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> |
| 112 | + |
| 113 | +<section class="intro"> |
| 114 | + |
| 115 | +</section> |
| 116 | + |
| 117 | +<!-- /.intro --> |
| 118 | + |
| 119 | +<!-- C usage documentation. --> |
| 120 | + |
| 121 | +<section class="usage"> |
| 122 | + |
| 123 | +### Usage |
| 124 | + |
| 125 | +```c |
| 126 | +#include "stdlib/math/base/special/acoversinf.h" |
| 127 | +``` |
| 128 | + |
| 129 | +#### stdlib_base_acoversinf( x ) |
| 130 | + |
| 131 | +Computes the [inverse coversed sine][inverse-coversed-sine] of a single-precision floating-point number (in radians). |
| 132 | + |
| 133 | +```c |
| 134 | +float out = stdlib_base_acoversinf( 3.141592653589793f / 2.0f ); |
| 135 | +// returns ~-0.6075f |
| 136 | +``` |
| 137 | + |
| 138 | +The function accepts the following arguments: |
| 139 | + |
| 140 | +- **x**: `[in] float` input value. |
| 141 | + |
| 142 | +```c |
| 143 | +float stdlib_base_acoversinf( const float x ); |
| 144 | +``` |
| 145 | +
|
| 146 | +</section> |
| 147 | +
|
| 148 | +<!-- /.usage --> |
| 149 | +
|
| 150 | +<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 151 | +
|
| 152 | +<section class="notes"> |
| 153 | +
|
| 154 | +</section> |
| 155 | +
|
| 156 | +<!-- /.notes --> |
| 157 | +
|
| 158 | +<!-- C API usage examples. --> |
| 159 | +
|
| 160 | +<section class="examples"> |
| 161 | +
|
| 162 | +### Examples |
| 163 | +
|
| 164 | +```c |
| 165 | +#include "stdlib/math/base/special/acoversinf.h" |
| 166 | +#include <stdio.h> |
| 167 | +
|
| 168 | +int main( void ) { |
| 169 | + const float x[] = { -5.0f, -3.89f, -2.78f, -1.67f, -0.56f, 0.56f, 1.67f, 2.78f, 3.89f, 5.0f }; |
| 170 | + |
| 171 | + float v; |
| 172 | + int i; |
| 173 | + for ( i = 0; i < 10; i++ ) { |
| 174 | + v = stdlib_base_acoversinf( x[ i ] ); |
| 175 | + printf( "acoversinf(%f) = %f\n", x[ i ], v ); |
| 176 | + } |
| 177 | +} |
| 178 | +``` |
| 179 | + |
| 180 | +</section> |
| 181 | + |
| 182 | +<!-- /.examples --> |
| 183 | + |
| 184 | +</section> |
| 185 | + |
| 186 | +<!-- /.c --> |
| 187 | + |
| 188 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 189 | + |
| 190 | +<section class="related"> |
| 191 | + |
| 192 | +</section> |
| 193 | + |
| 194 | +<!-- /.related --> |
| 195 | + |
| 196 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 197 | + |
| 198 | +<section class="links"> |
| 199 | + |
| 200 | +[inverse-coversed-sine]: https://en.wikipedia.org/wiki/Versine |
| 201 | + |
| 202 | +<!-- <related-links> --> |
| 203 | + |
| 204 | +<!-- </related-links> --> |
| 205 | + |
| 206 | +</section> |
| 207 | + |
| 208 | +<!-- /.links --> |
0 commit comments