The toRadians() function in Scala converts a value in degrees to an equal value in radians.
The image below shows the mathematical representation of the toRadians() function.
The following module is required for this function:
import scala.math._
Double toRadians(Double number)
The toRadians() function takes a 
The toRadians() function converts the degree value sent as a parameter to a value in radians.
- If the parameter value is
PositiveInfinity, thentoRadians()returns positive infinity.- If the parameter value is
NegativeInfinity, thentoRadians()returns negative infinity.- If the parameter value is
NaN, thentoRadians()returnsNaN.
import scala.math._object Main extends App {//The radians value of 180println(s"The value of toRadians(180) = ${toRadians(180)}");//The radians value of 0println(s"The value of toRadians(0) = ${toRadians(0)}");//The radians value of -180println(s"The value of toRadians(-180) = ${toRadians(-180)}");//Error output ~ The radians value of Infinityprintln(s"The value of toRadians(Double.PositiveInfinity) = ${toRadians(Double.PositiveInfinity)}");//Error output ~ The radians value of -Infinityprintln(s"The value of toRadians(Double.NegativeInfinity) = ${toRadians(Double.NegativeInfinity)}");//Error output ~ The radians value of NaNprintln(s"The value of toRadians(Double.NaN) = ${toRadians(Double.NaN)}");}