|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2025 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 | +# exp10f |
| 22 | + |
| 23 | +> Base `10` [single-precision exponential function][exponential-function]. |
| 24 | +
|
| 25 | +<section class="usage"> |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +```javascript |
| 30 | +var exp10f = require( '@stdlib/math/base/special/exp10f' ); |
| 31 | +``` |
| 32 | + |
| 33 | +#### exp10f( x ) |
| 34 | + |
| 35 | +Evaluates the base `10` [single-precision exponential function][exponential-function]. |
| 36 | + |
| 37 | +```javascript |
| 38 | +var v = exp10f( 3.0 ); |
| 39 | +// returns 1000.0 |
| 40 | + |
| 41 | +v = exp10f( -9.0 ); |
| 42 | +// returns 9.999999717180685e-10 |
| 43 | + |
| 44 | +v = exp10f( 0.0 ); |
| 45 | +// returns 1.0 |
| 46 | + |
| 47 | +v = exp10f( NaN ); |
| 48 | +// returns NaN |
| 49 | +``` |
| 50 | + |
| 51 | +</section> |
| 52 | + |
| 53 | +<!-- /.usage --> |
| 54 | + |
| 55 | +<section class="examples"> |
| 56 | + |
| 57 | +## Examples |
| 58 | + |
| 59 | +<!-- eslint no-undef: "error" --> |
| 60 | + |
| 61 | +```javascript |
| 62 | +var exp10f = require( '@stdlib/math/base/special/exp10f' ); |
| 63 | +var uniform = require( '@stdlib/random/array/uniform' ); |
| 64 | +var logEachMap = require( '@stdlib/console/log-each-map' ); |
| 65 | +var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); |
| 66 | + |
| 67 | +var opts = { |
| 68 | + 'dtype': 'float64' |
| 69 | +}; |
| 70 | +var x = uniform( 100, -50.0, 50.0, opts ); |
| 71 | + |
| 72 | +// Convert to single-precision: |
| 73 | +x = x.map( float64ToFloat32 ); |
| 74 | + |
| 75 | +logEachMap( '10^%0.4f = %0.4f', x, exp10f ); |
| 76 | +``` |
| 77 | + |
| 78 | +</section> |
| 79 | + |
| 80 | +<!-- /.examples --> |
| 81 | + |
| 82 | +* * * |
| 83 | + |
| 84 | +<section class="c"> |
| 85 | + |
| 86 | +## C APIs |
| 87 | + |
| 88 | +<section class="intro"> |
| 89 | + |
| 90 | +C API providing a base 10 single-precision exponential function. |
| 91 | + |
| 92 | +</section> |
| 93 | + |
| 94 | +<!-- /.intro --> |
| 95 | + |
| 96 | +<section class="usage"> |
| 97 | + |
| 98 | +### Usage |
| 99 | + |
| 100 | +```c |
| 101 | +#include "stdlib/math/base/special/exp10f.h" |
| 102 | +``` |
| 103 | + |
| 104 | +#### stdlib_base_exp10f( x ) |
| 105 | + |
| 106 | +Evaluates the base `10` [single-precision exponential function][exponential-function]. |
| 107 | + |
| 108 | +```c |
| 109 | +float out = stdlib_base_exp10f( 3.0f ); |
| 110 | +// returns 1000.0f |
| 111 | + |
| 112 | +out = stdlib_base_exp10f( -9.0f ); |
| 113 | +// returns 1.0e-9f |
| 114 | +``` |
| 115 | + |
| 116 | +The function accepts the following arguments: |
| 117 | + |
| 118 | +- **x**: `[in] float` input value. |
| 119 | + |
| 120 | +```c |
| 121 | +float stdlib_base_exp10f( const float x ); |
| 122 | +``` |
| 123 | +
|
| 124 | +</section> |
| 125 | +
|
| 126 | +<!-- /.usage --> |
| 127 | +
|
| 128 | +<section class="notes"> |
| 129 | +
|
| 130 | +</section> |
| 131 | +
|
| 132 | +<!-- /.notes --> |
| 133 | +
|
| 134 | +<section class="examples"> |
| 135 | +
|
| 136 | +### Examples |
| 137 | +
|
| 138 | +```c |
| 139 | +#include "stdlib/math/base/special/exp10f.h" |
| 140 | +#include <stdlib.h> |
| 141 | +#include <stdio.h> |
| 142 | +
|
| 143 | +int main( void ) { |
| 144 | + float x; |
| 145 | + float v; |
| 146 | + int i; |
| 147 | +
|
| 148 | + for ( i = 0; i < 100; i++ ) { |
| 149 | + x = ( ( (float)rand() / (float)RAND_MAX ) * 100.0f ) - 50.0f; |
| 150 | + v = stdlib_base_exp10f( x ); |
| 151 | + printf( "10^%f = %f\n", x, v ); |
| 152 | + } |
| 153 | +} |
| 154 | +``` |
| 155 | + |
| 156 | +</section> |
| 157 | + |
| 158 | +<!-- /.examples --> |
| 159 | + |
| 160 | +</section> |
| 161 | + |
| 162 | +<!-- /.c --> |
| 163 | + |
| 164 | +<section class="related"> |
| 165 | + |
| 166 | +* * * |
| 167 | + |
| 168 | +## See Also |
| 169 | + |
| 170 | +- <span class="package-name">[`@stdlib/math/base/special/exp`][@stdlib/math/base/special/exp]</span><span class="delimiter">: </span><span class="description">natural exponential function.</span> |
| 171 | +- <span class="package-name">[`@stdlib/math/base/special/exp2`][@stdlib/math/base/special/exp2]</span><span class="delimiter">: </span><span class="description">base 2 exponential function.</span> |
| 172 | +- <span class="package-name">[`@stdlib/math/base/special/log10`][@stdlib/math/base/special/log10]</span><span class="delimiter">: </span><span class="description">common logarithm (base ten).</span> |
| 173 | + |
| 174 | +</section> |
| 175 | + |
| 176 | +<!-- /.related --> |
| 177 | + |
| 178 | +<section class="links"> |
| 179 | + |
| 180 | +[exponential-function]: https://en.wikipedia.org/wiki/Exponential_function |
| 181 | + |
| 182 | +<!-- <related-links> --> |
| 183 | + |
| 184 | +[@stdlib/math/base/special/exp]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/exp |
| 185 | + |
| 186 | +[@stdlib/math/base/special/exp2]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/exp2 |
| 187 | + |
| 188 | +[@stdlib/math/base/special/log10]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/math/base/special/log10 |
| 189 | + |
| 190 | +<!-- </related-links> --> |
| 191 | + |
| 192 | +</section> |
| 193 | + |
| 194 | +<!-- /.links --> |
0 commit comments