@@ -15,7 +15,7 @@ module stdlib_math
15
15
#:endif
16
16
public :: DEFAULT_LINSPACE_LENGTH, DEFAULT_LOGSPACE_BASE, DEFAULT_LOGSPACE_LENGTH
17
17
public :: stdlib_meshgrid_ij, stdlib_meshgrid_xy
18
- public :: arange, arg, argd, argpi, is_close, all_close, diff, meshgrid
18
+ public :: arange, arg, argd, argpi, deg2rad, rad2deg, is_close, all_close, diff, meshgrid
19
19
20
20
integer, parameter :: DEFAULT_LINSPACE_LENGTH = 100
21
21
integer, parameter :: DEFAULT_LOGSPACE_LENGTH = 50
@@ -332,6 +332,26 @@ module stdlib_math
332
332
procedure :: argpi_${k1}$
333
333
#:endfor
334
334
end interface argpi
335
+
336
+ !> Version: experimental
337
+ !>
338
+ !> `deg2rad` converts phase angles from degrees to radians.
339
+ !> ([Specification](../page/specs/stdlib_math.html#deg2rad-function))
340
+ interface deg2rad
341
+ #:for k1 in REAL_KINDS
342
+ procedure :: deg2rad_${k1}$
343
+ #:endfor
344
+ end interface deg2rad
345
+
346
+ !> Version: experimental
347
+ !>
348
+ !> `rad2deg` converts phase angles from radians to degrees.
349
+ !> ([Specification](../page/specs/stdlib_math.html#rad2deg-function))
350
+ interface rad2deg
351
+ #:for k1 in REAL_KINDS
352
+ procedure :: rad2deg_${k1}$
353
+ #:endfor
354
+ end interface rad2deg
335
355
336
356
!> Returns a boolean scalar/array where two scalar/arrays are element-wise equal within a tolerance.
337
357
!> ([Specification](../page/specs/stdlib_math.html#is_close-function))
@@ -453,6 +473,22 @@ contains
453
473
end function argpi_${k1}$
454
474
#:endfor
455
475
476
+ #:for k1, t1 in REAL_KINDS_TYPES
477
+ elemental function deg2rad_${k1}$(theta) result(result)
478
+ ${t1}$, intent(in) :: theta
479
+ ${t1}$ :: result
480
+ result = theta * PI_${k1}$ / 180.0_${k1}$
481
+
482
+ end function deg2rad_${k1}$
483
+
484
+ elemental function rad2deg_${k1}$(theta) result(result)
485
+ ${t1}$, intent(in) :: theta
486
+ ${t1}$ :: result
487
+ result = theta * 180.0_${k1}$ / PI_${k1}$
488
+
489
+ end function rad2deg_${k1}$
490
+ #:endfor
491
+
456
492
#:for k1, t1 in INT_KINDS_TYPES
457
493
!> Returns the greatest common divisor of two integers of kind ${k1}$
458
494
!> using the Euclidean algorithm.
0 commit comments