time-to-botec

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

README.md (3935B)


      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 # Float word Order
     22 
     23 > Platform [float word order][endianness].
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var FLOAT_WORD_ORDER = require( '@stdlib/os/float-word-order' );
     31 ```
     32 
     33 #### FLOAT_WORD_ORDER
     34 
     35 Platform float word order.
     36 
     37 ```javascript
     38 console.log( FLOAT_WORD_ORDER );
     39 // => <string>
     40 ```
     41 
     42 </section>
     43 
     44 <!-- /.usage -->
     45 
     46 <section class="notes">
     47 
     48 ## Notes
     49 
     50 -   The following values are possible:
     51 
     52     -   `'little-endian'`
     53     -   `'big-endian'`
     54     -   `'unknown'`
     55 
     56 </section>
     57 
     58 <!-- /.notes -->
     59 
     60 <section class="examples">
     61 
     62 ## Examples
     63 
     64 <!-- eslint no-undef: "error" -->
     65 
     66 ```javascript
     67 var FLOAT_WORD_ORDER = require( '@stdlib/os/float-word-order' );
     68 
     69 if ( FLOAT_WORD_ORDER === 'little-endian' ) {
     70     console.log( 'Least significant word comes first...' );
     71 } else if ( FLOAT_WORD_ORDER === 'big-endian' ) {
     72     console.log( 'Most significant word comes first...' );
     73 } else {
     74     console.log( 'This is uncommon...' );
     75 }
     76 ```
     77 
     78 </section>
     79 
     80 <!-- /.examples -->
     81 
     82 <!-- C interface documentation. -->
     83 
     84 * * *
     85 
     86 <section class="c">
     87 
     88 ## C APIs
     89 
     90 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
     91 
     92 <section class="intro">
     93 
     94 </section>
     95 
     96 <!-- /.intro -->
     97 
     98 <!-- C usage documentation. -->
     99 
    100 <section class="usage">
    101 
    102 ### Usage
    103 
    104 ```c
    105 #include "stdlib/os/float_word_order.h"
    106 ```
    107 
    108 #### STDLIB_OS_FLOAT_WORD_ORDER
    109 
    110 Macro which equals either `__FLOAT_WORD_ORDER__` (host defined) or [`STDLIB_OS_BYTE_ORDER`][@stdlib/os/byte-order].
    111 
    112 ```c
    113 #include "stdlib/os/byte_order.h"
    114 
    115 #if defined(STDLIB_OS_FLOAT_WORD_ORDER)
    116 
    117 #if STDLIB_OS_FLOAT_WORD_ORDER == STDLIB_OS_ORDER_LITTLE_ENDIAN
    118 
    119 // Do something for little-endian...
    120 
    121 #elif STDLIB_OS_FLOAT_WORD_ORDER == STDLIB_OS_ORDER_BIG_ENDIAN
    122 
    123 // Do something for big-endian...
    124 
    125 #endif
    126 
    127 #endif
    128 ```
    129 
    130 If compiled on an unrecognized/unsupported platform, the macro is **not** defined.
    131 
    132 </section>
    133 
    134 <!-- /.usage -->
    135 
    136 <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    137 
    138 <section class="notes">
    139 
    140 </section>
    141 
    142 <!-- /.notes -->
    143 
    144 <!-- C API usage examples. -->
    145 
    146 <section class="examples">
    147 
    148 ### Examples
    149 
    150 ```c
    151 #include "stdlib/os/float_word_order.h"
    152 #include "stdlib/os/byte_order.h"
    153 #include <stdio.h>
    154 
    155 int main() {
    156 #if defined(STDLIB_OS_FLOAT_WORD_ORDER)
    157 #if STDLIB_OS_FLOAT_WORD_ORDER == STDLIB_OS_ORDER_LITTLE_ENDIAN
    158     printf( "Least significant word comes first...\n" );
    159 #elif STDLIB_OS_FLOAT_WORD_ORDER == STDLIB_OS_ORDER_BIG_ENDIAN
    160     printf( "Most significant word comes first...\n" );
    161 #else
    162     printf( "Platform float word order is unknown...\n" )
    163 #endif
    164 #endif
    165 }
    166 ```
    167 
    168 </section>
    169 
    170 <!-- /.examples -->
    171 
    172 </section>
    173 
    174 <!-- /.c -->
    175 
    176 * * *
    177 
    178 <section class="cli">
    179 
    180 ## CLI
    181 
    182 <section class="usage">
    183 
    184 ### Usage
    185 
    186 ```text
    187 Usage: float-word-order [options]
    188 
    189 Options:
    190 
    191   -h,    --help                Print this message.
    192   -V,    --version             Print the package version.
    193 ```
    194 
    195 </section>
    196 
    197 <!-- /.usage -->
    198 
    199 <section class="examples">
    200 
    201 ### Examples
    202 
    203 ```bash
    204 $ float-word-order
    205 ```
    206 
    207 </section>
    208 
    209 <!-- /.examples -->
    210 
    211 </section>
    212 
    213 <!-- /.cli -->
    214 
    215 <section class="links">
    216 
    217 [endianness]: https://en.wikipedia.org/wiki/Endianness
    218 
    219 [@stdlib/os/byte-order]: https://www.npmjs.com/package/@stdlib/os/tree/main/byte-order
    220 
    221 </section>
    222 
    223 <!-- /.links -->