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) | June 29, 2025 |
Generated by manServer 1.08 from af679bcf-0cca-4f2e-99d9-d5e576b74df0 using man macros.