time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (2892B)


      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 # floorf
     22 
     23 > Round a single-precision floating-point numeric value toward negative infinity.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var floorf = require( '@stdlib/math/base/special/floorf' );
     31 ```
     32 
     33 #### floorf( x )
     34 
     35 Rounds a single-precision floating-point `numeric` value toward negative infinity.
     36 
     37 ```javascript
     38 var v = floorf( -4.2 );
     39 // returns -5.0
     40 
     41 v = floorf( 9.99999 );
     42 // returns 9.0
     43 
     44 v = floorf( 0.0 );
     45 // returns 0.0
     46 
     47 v = floorf( 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 floorf = require( '@stdlib/math/base/special/floorf' );
     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( 'floorf(%d) = %d', x, floorf( 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/floorf.h"
    102 ```
    103 
    104 #### stdlib_base_floorf( x )
    105 
    106 Rounds a single-precision floating-point number toward negative infinity.
    107 
    108 ```c
    109 float y = stdlib_base_floorf( 3.14f );
    110 // returns 3.0
    111 ```
    112 
    113 The function accepts the following arguments:
    114 
    115 -   **x**: `[in] float` input value.
    116 
    117 ```c
    118 float stdlib_base_floor( 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/floorf.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_floorf( x[ i ] );
    150         printf( "floorf(%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 -->