RadToDeg v0.1.0

Source
Converts an angle from radians to degrees.

Package: Math

Signature

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

Parameters

NameTypeDescription
xfloat64 / float32An angle, in radians.

Returns

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

Example

import Math::{ HalfPi, Pi, RadToDeg };

func Main() -> int {
    let degrees = RadToDeg(Pi);    // 180.0
    let ninety = RadToDeg(HalfPi); // 90.0
    return 0;
}

See also

  • Math — the package overview
  • DegToRad — the inverse conversion
  • Sin / Cos / Tan — trigonometric functions that return radians
  • DegPerRad — the constant this function multiplies by