Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

julia
communitycreator

How to use the rad2deg method in Julia

Programming Bytes

Overview

The rad2deg() method can convert the given radian value to a degree value.

Syntax

rad2deg(radian)
Julia rad2deg function Syntax

Parameter

This method takes the parameter radian, representing the radian value for which the degree value is found.

Return value

This method returns the degree value of the given radian.

Example

The code below demonstrates how to use the rad2deg method.

## find degree of 0 radian
radian = 0
println( "Degree value of $(radian) radian is : $(rad2deg(radian))")

## find degree of 0.17453292519943295 radian
radian = 0.17453292519943295
println( "Degree value of $(radian) radian is : $(rad2deg(radian))")
Using the deg2rad method

Explanation

  • Line 2: We create a new variable degree and assigned 0 as its value.
  • Line 3: We use the rad2deg method with the variable radian as an argument. This method converts the radians to degrees. The degree value of radian 0 is 0.0.
  • Line 6: We assign 0.17453292519943295 as the value for the variable radian.
  • Line 7: We used the rad2deg method with the variable radian as an argument. This method will convert the radian to a degree. The degree value of 0.17453292519943295 radians is 10.0.

RELATED TAGS

julia
communitycreator
RELATED COURSES

View all Courses

Keep Exploring