C Library Functions  - r2d (3)

NAME

r2d(3f) - [M_units:TRIGONOMETRY] convert radians to degrees (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Example
Author
License

SYNOPSIS

elemental real function r2d(radians)

    class(*),intent(in) :: degrees

DESCRIPTION

Converts radians to degrees using the formula:

    degrees=real(radians * 180.d0 / acos(-1.0d0))

OPTIONS

radians
  any standard scalar value supported by anyscalar_to_real(3f).

EXAMPLE

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_r2d

Results

    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

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 r2d (3) July 22, 2023
Generated by manServer 1.08 from 847282a0-0315-4d6f-b144-100973d38263 using man macros.