r2d(3f) - [M_units:TRIGONOMETRY] convert radians to degrees (LICENSE:PD)
Synopsis
Description
Options
Example
Author
License
elemental real function r2d(radians)
class(*),intent(in) :: degrees
Converts radians to degrees using the formula:
degrees=real(radians * 180.d0 / acos(-1.0d0))
radians any standard scalar value supported by anyscalar_to_real(3f).
Sample program
program demo_r2d use M_units, only : r2d use M_units, only : pi8=>pi implicit none real :: pi=real(pi8) write(*,*)With REAL array input , r2d([ 0.0, PI/4.0, PI/2.0, 3.0*PI/2.0, PI ]) write(*,*)With INTEGER array input , r2d([0,1,2,3,4]) write(*,*)With DOUBLEPRECISION , r2d(0.0d0),r2d(PI/4.0d0),r2d(PI/2.0d0),r2d(3.0d0*PI/2.0d0),r2d(PI) end program demo_r2dResults
With REAL array input 0.00000000 45.0000000 90.0000000 270.000000 180.000000 With INTEGER array input 0.00000000 57.2957802 114.591560 171.887344 229.183121 With DOUBLEPRECISION 0.00000000 45.0000000 90.0000000 270.000000 180.000000
John S. Urban
Public Domain
Nemo Release 3.1 | r2d (3) | February 23, 2025 |