time-to-botec

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

README.md (1798B)


      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 # rad2deg
     22 
     23 > Convert an angle from radians to degrees.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var rad2deg = require( '@stdlib/math/base/special/rad2deg' );
     31 ```
     32 
     33 #### rad2deg( x )
     34 
     35 Converts an angle from radians to degrees.
     36 
     37 ```javascript
     38 var d = rad2deg( 3.141592653589793/2.0 );
     39 // returns 90.0
     40 
     41 d = rad2deg( -3.141592653589793/4.0 );
     42 // returns -45.0
     43 
     44 d = rad2deg( NaN );
     45 // returns NaN
     46 ```
     47 
     48 </section>
     49 
     50 <!-- /.usage -->
     51 
     52 <section class="notes">
     53 
     54 ## Notes
     55 
     56 -   Due to finite precision, canonical values may not be returned. For example,
     57 
     58     ```javascript
     59     var d = rad2deg( 3.141592653589793/6.0 );
     60     // returns 29.999999999999996
     61     ```
     62 
     63 </section>
     64 
     65 <!-- /.notes -->
     66 
     67 <section class="examples">
     68 
     69 ## Examples
     70 
     71 <!-- eslint no-undef: "error" -->
     72 
     73 ```javascript
     74 var randu = require( '@stdlib/random/base/randu' );
     75 var TWO_PI = require( '@stdlib/constants/float64/two-pi' );
     76 var rad2deg = require( '@stdlib/math/base/special/rad2deg' );
     77 
     78 var r;
     79 var d;
     80 var i;
     81 
     82 for ( i = 0; i < 100; i++ ) {
     83     r = randu() * TWO_PI;
     84     d = rad2deg( r );
     85     console.log( 'radians: %d => degrees: %d', r, d );
     86 }
     87 ```
     88 
     89 </section>
     90 
     91 <!-- /.examples -->
     92 
     93 <section class="links">
     94 
     95 </section>
     96 
     97 <!-- /.links -->