README.md (2860B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2020 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 # ceilf 22 23 > Round a single-precision floating-point number toward positive infinity. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var ceilf = require( '@stdlib/math/base/special/ceilf' ); 31 ``` 32 33 #### ceilf( x ) 34 35 Rounds a single-precision floating-point number toward positive infinity. 36 37 ```javascript 38 var v = ceilf( -4.2 ); 39 // returns -4.0 40 41 v = ceilf( 9.99999 ); 42 // returns 10.0 43 44 v = ceilf( 0.0 ); 45 // returns 0.0 46 47 v = ceilf( 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 randu = require( '@stdlib/random/base/randu' ); 63 var ceilf = require( '@stdlib/math/base/special/ceilf' ); 64 65 var x; 66 var i; 67 68 for ( i = 0; i < 100; i++ ) { 69 x = (randu()*100.0) - 50.0; 70 console.log( 'ceilf(%d) = %d', x, ceilf( x ) ); 71 } 72 ``` 73 74 </section> 75 76 <!-- /.examples --> 77 78 <!-- C interface documentation. --> 79 80 * * * 81 82 <section class="c"> 83 84 ## C APIs 85 86 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> 87 88 <section class="intro"> 89 90 </section> 91 92 <!-- /.intro --> 93 94 <!-- C usage documentation. --> 95 96 <section class="usage"> 97 98 ### Usage 99 100 ```c 101 #include "stdlib/math/base/special/ceilf.h" 102 ``` 103 104 #### stdlib_base_ceilf( x ) 105 106 Rounds a single-precision floating-point number toward positive infinity. 107 108 ```c 109 float y = stdlib_base_ceilf( 3.14f ); 110 // returns 4.0f 111 ``` 112 113 The function accepts the following arguments: 114 115 - **x**: `[in] float` input value. 116 117 ```c 118 float stdlib_base_ceilf( const float x ); 119 ``` 120 121 </section> 122 123 <!-- /.usage --> 124 125 <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> 126 127 <section class="notes"> 128 129 </section> 130 131 <!-- /.notes --> 132 133 <!-- C API usage examples. --> 134 135 <section class="examples"> 136 137 ### Examples 138 139 ```c 140 #include "stdlib/math/base/special/ceilf.h" 141 #include <stdio.h> 142 143 int main() { 144 float x[] = { 3.14f, -3.14f, 0.0f, 0.0f/0.0f }; 145 146 float y; 147 int i; 148 for ( i = 0; i < 4; i++ ) { 149 y = stdlib_base_ceilf( x[ i ] ); 150 printf( "ceilf(%f) = %f\n", x[ i ], y ); 151 } 152 } 153 ``` 154 155 </section> 156 157 <!-- /.examples --> 158 159 </section> 160 161 <!-- /.c --> 162 163 <section class="links"> 164 165 </section> 166 167 <!-- /.links -->