Method Deck / units

Angle conversion

Converts a plane angle between degree, radian, gradian, arcminute, and arcsecond per the BIPM SI Brochure definitions.

Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.

Try it

Inputs

Outputs

Steps

  1. Look up the exact radian-equivalent of from_unit and of to_unit: degree = pi/180 rad; gradian = pi/200 rad; arcminute = pi/(180*60) rad; arcsecond = pi/(180*3600) rad.
  2. Convert the input to radians: radians = value * rad_per(from_unit).
  3. Convert radians to the target unit: result = radians / rad_per(to_unit).
  4. Round result to 6 significant figures.

Constants

Sources

Worked example and test vectors

NameInputsAnswer
worked example{"value":180,"from_unit":"degree","to_unit":"radian"}3.14159 radian
test vector: gradians to degrees{"value":100,"from_unit":"gradian","to_unit":"degree"}90.0000 degree
test vector: degree to arcminute{"value":1,"from_unit":"degree","to_unit":"arcminute"}60.0000 arcminute

Published card