DegToRad v0.1.0

Source
Converts an angle from degrees to radians.

Package: Math

Signature

func DegToRad(x: float64) -> float64;
func DegToRad(x: float32) -> float32;

Parameters

NameTypeDescription
xfloat64 / float32An angle, in degrees.

Returns

x scaled by Pi/180. The conversion is faithful enough that round numbers come out exact: DegToRad(180.0) is Pi. Infinities, NaN, and the sign of a zero all fall out of the multiplication unchanged.

Example

import Math::DegToRad;

func Main() -> int {
    let radians = DegToRad(180.0); // 3.141592653589793 (Pi)
    let quarter = DegToRad(90.0);  // 1.5707963267948966 (HalfPi)
    return 0;
}

See also

  • Math — the package overview
  • RadToDeg — the inverse conversion
  • Sin / Cos / Tan — trigonometric functions that expect radians
  • RadPerDeg — the constant this function multiplies by