|
| 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 | +# atandf |
| 22 | + |
| 23 | +> Compute the [arctangent][arctangent] in degrees of a single-precision floating-point number. |
| 24 | +
|
| 25 | +<section class="usage"> |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +```javascript |
| 30 | +var atandf = require( '@stdlib/math/base/special/atandf' ); |
| 31 | +``` |
| 32 | + |
| 33 | +#### atandf( x ) |
| 34 | + |
| 35 | +Computes the [arctangent][arctangent] (in degrees) of a single-precision floating-point number. |
| 36 | + |
| 37 | +```javascript |
| 38 | +var sqrtf = require( '@stdlib/math/base/special/sqrtf' ); |
| 39 | +var v = atandf( 0.0 ); |
| 40 | +// returns 0.0 |
| 41 | + |
| 42 | +v = atandf( 0.5 ); |
| 43 | +// returns ~26.57 |
| 44 | + |
| 45 | +v = atandf( 1.0 / sqrtf( 3.0 ) ); |
| 46 | +// returns ~30.0 |
| 47 | + |
| 48 | +v = atandf( 1.0 ); |
| 49 | +// returns 45.0 |
| 50 | + |
| 51 | +v = atandf( Infinity ); |
| 52 | +// returns 90.0 |
| 53 | + |
| 54 | +v = atandf( NaN ); |
| 55 | +// returns NaN |
| 56 | +``` |
| 57 | + |
| 58 | +</section> |
| 59 | + |
| 60 | +<!-- /.usage --> |
| 61 | + |
| 62 | +<section class="examples"> |
| 63 | + |
| 64 | +## Examples |
| 65 | + |
| 66 | +<!-- eslint no-undef: "error" --> |
| 67 | + |
| 68 | +```javascript |
| 69 | +var linspace = require( '@stdlib/array/base/linspace' ); |
| 70 | +var atandf = require( '@stdlib/math/base/special/atandf' ); |
| 71 | + |
| 72 | +var x = linspace( -1.0, 1.0, 100 ); |
| 73 | + |
| 74 | +var i; |
| 75 | +for ( i = 0; i < x.length; i++ ) { |
| 76 | + console.log( atandf( x[ i ] ) ); |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +</section> |
| 81 | + |
| 82 | +<!-- /.examples --> |
| 83 | + |
| 84 | +<!-- C interface documentation. --> |
| 85 | + |
| 86 | +* * * |
| 87 | + |
| 88 | +<section class="c"> |
| 89 | + |
| 90 | +## C APIs |
| 91 | + |
| 92 | +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> |
| 93 | + |
| 94 | +<section class="intro"> |
| 95 | + |
| 96 | +</section> |
| 97 | + |
| 98 | +<!-- /.intro --> |
| 99 | + |
| 100 | +<!-- C usage documentation. --> |
| 101 | + |
| 102 | +<section class="usage"> |
| 103 | + |
| 104 | +### Usage |
| 105 | + |
| 106 | +```c |
| 107 | +#include "stdlib/math/base/special/atandf.h" |
| 108 | +``` |
| 109 | + |
| 110 | +#### stdlib_base_atandf( x ) |
| 111 | + |
| 112 | +Computes the [arctangent][arctangent] (in degrees) of a single-precision floating-point number. |
| 113 | + |
| 114 | +```c |
| 115 | +float out = stdlib_base_atandf( 0.0f ); |
| 116 | +// returns 0.0f |
| 117 | + |
| 118 | +out = stdlib_base_atandf( 0.5f ); |
| 119 | +// returns ~26.57f |
| 120 | +``` |
| 121 | + |
| 122 | +The function accepts the following arguments: |
| 123 | + |
| 124 | +- **x**: `[in] float` input value. |
| 125 | + |
| 126 | +```c |
| 127 | +float stdlib_base_atandf( const float x ); |
| 128 | +``` |
| 129 | +
|
| 130 | +</section> |
| 131 | +
|
| 132 | +<!-- /.usage --> |
| 133 | +
|
| 134 | +<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 135 | +
|
| 136 | +<section class="notes"> |
| 137 | +
|
| 138 | +</section> |
| 139 | +
|
| 140 | +<!-- /.notes --> |
| 141 | +
|
| 142 | +<!-- C API usage examples. --> |
| 143 | +
|
| 144 | +<section class="examples"> |
| 145 | +
|
| 146 | +### Examples |
| 147 | +
|
| 148 | +```c |
| 149 | +#include "stdlib/math/base/special/atandf.h" |
| 150 | +#include <stdio.h> |
| 151 | +
|
| 152 | +int main( void ) { |
| 153 | + const float x[] = { 1.0f, 1.45f, 1.89f, 2.33f, 2.78f, 3.22f, 3.66f, 4.11f, 4.55f, 5.0f }; |
| 154 | + |
| 155 | + float v; |
| 156 | + int i; |
| 157 | + for ( i = 0; i < 10; i++ ) { |
| 158 | + v = stdlib_base_atandf( x[ i ] ); |
| 159 | + printf( "atandf(%f) = %f\n", x[ i ], v ); |
| 160 | + } |
| 161 | +} |
| 162 | +``` |
| 163 | + |
| 164 | +</section> |
| 165 | + |
| 166 | +<!-- /.examples --> |
| 167 | + |
| 168 | +</section> |
| 169 | + |
| 170 | +<!-- /.c --> |
| 171 | + |
| 172 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 173 | + |
| 174 | +<section class="related"> |
| 175 | + |
| 176 | +</section> |
| 177 | + |
| 178 | +<!-- /.related --> |
| 179 | + |
| 180 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 181 | + |
| 182 | +<section class="links"> |
| 183 | + |
| 184 | +[arctangent]: https://en.wikipedia.org/wiki/Inverse_trigonometric_functions |
| 185 | + |
| 186 | +<!-- <related-links> --> |
| 187 | + |
| 188 | +<!-- </related-links> --> |
| 189 | + |
| 190 | +</section> |
| 191 | + |
| 192 | +<!-- /.links --> |
0 commit comments