Skip to content

Commit 1d0b054

Browse files
committed
Add examples for deg2rad and rad2deg.
1 parent 9b3ed04 commit 1d0b054

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

example/math/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ ADD_EXAMPLE(math_arange)
1212
ADD_EXAMPLE(math_argd)
1313
ADD_EXAMPLE(math_arg)
1414
ADD_EXAMPLE(math_argpi)
15+
ADD_EXAMPLE(math_deg2rad)
16+
ADD_EXAMPLE(math_rad2deg)
1517
ADD_EXAMPLE(math_is_close)
1618
ADD_EXAMPLE(meshgrid)

example/math/example_math_deg2rad.f90

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
program example_math_deg2rad
2+
use stdlib_math, only: deg2rad
3+
implicit none
4+
print *, deg2rad(0.0) ! 0.0
5+
print *, deg2rad(90.0) ! 1.57508
6+
print *, deg2rad(-180.0) ! -3.1416
7+
8+
end program example_math_deg2rad

example/math/example_math_rad2deg.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
program example_math_rad2deg
2+
use stdlib_math, only: rad2deg
3+
use stdlib_constants, only: PI_sp
4+
implicit none
5+
print *, rad2deg(0.0) ! 0.0
6+
print *, rad2deg(PI_sp / 2.0) ! 90.0
7+
print *, rad2deg(-PI_sp) ! -3.1416
8+
9+
end program example_math_rad2deg

0 commit comments

Comments
 (0)