time-to-botec

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

README.md (2804B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2018 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 # deg2rad
     22 
     23 > Convert an angle from degrees to radians.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var deg2rad = require( '@stdlib/math/base/special/deg2rad' );
     31 ```
     32 
     33 #### deg2rad( x )
     34 
     35 Converts an angle from degrees to radians.
     36 
     37 ```javascript
     38 var r = deg2rad( 90.0 );
     39 // returns ~1.571
     40 
     41 r = deg2rad( -45.0 );
     42 // returns ~-0.785
     43 
     44 r = deg2rad( NaN );
     45 // returns NaN
     46 ```
     47 
     48 </section>
     49 
     50 <!-- /.usage -->
     51 
     52 <section class="examples">
     53 
     54 ## Examples
     55 
     56 <!-- eslint no-undef: "error" -->
     57 
     58 ```javascript
     59 var randu = require( '@stdlib/random/base/randu' );
     60 var deg2rad = require( '@stdlib/math/base/special/deg2rad' );
     61 
     62 var d;
     63 var r;
     64 var i;
     65 
     66 for ( i = 0; i < 100; i++ ) {
     67     d = (randu()*720.0) - 360.0;
     68     r = deg2rad( d );
     69     console.log( 'degrees: %d => radians: %d', d, r );
     70 }
     71 ```
     72 
     73 </section>
     74 
     75 <!-- /.examples -->
     76 
     77 <!-- C interface documentation. -->
     78 
     79 * * *
     80 
     81 <section class="c">
     82 
     83 ## C APIs
     84 
     85 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
     86 
     87 <section class="intro">
     88 
     89 </section>
     90 
     91 <!-- /.intro -->
     92 
     93 <!-- C usage documentation. -->
     94 
     95 <section class="usage">
     96 
     97 ### Usage
     98 
     99 ```c
    100 #include "stdlib/math/base/special/deg2rad.h"
    101 ```
    102 
    103 #### stdlib_base_deg2rad( x )
    104 
    105 Converts an angle from degrees to radians.
    106 
    107 ```c
    108 double y = stdlib_base_deg2rad( 90.0 );
    109 // returns ~1.571
    110 ```
    111 
    112 The function accepts the following arguments:
    113 
    114 -   **x**: `[in] double` input value.
    115 
    116 ```c
    117 double stdlib_base_deg2rad( const double x );
    118 ```
    119 
    120 </section>
    121 
    122 <!-- /.usage -->
    123 
    124 <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    125 
    126 <section class="notes">
    127 
    128 </section>
    129 
    130 <!-- /.notes -->
    131 
    132 <!-- C API usage examples. -->
    133 
    134 <section class="examples">
    135 
    136 ### Examples
    137 
    138 ```c
    139 #include "stdlib/math/base/special/deg2rad.h"
    140 #include <stdio.h>
    141 
    142 int main() {
    143     double x[] = { 45.0, 90.0, 0.0, 0.0/0.0 };
    144 
    145     double y;
    146     int i;
    147     for ( i = 0; i < 4; i++ ) {
    148         y = stdlib_base_deg2rad( x[ i ] );
    149         printf( "deg2rad(%lf) = %lf\n", x[ i ], y );
    150     }
    151 }
    152 ```
    153 
    154 </section>
    155 
    156 <!-- /.examples -->
    157 
    158 </section>
    159 
    160 <!-- /.c -->
    161 
    162 <section class="links">
    163 
    164 </section>
    165 
    166 <!-- /.links -->