Method Deck / geometry

Circle circumference and area

Computes a circle's circumference and area from its radius or diameter.

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

Try it

Inputs

Outputs

Steps

  1. If which_given is diameter, radius = value / 2; otherwise radius = value.
  2. circumference = 2 * pi * radius.
  3. area = pi * radius^2.
  4. Round both to 2 decimals.

Constants

Sources

Worked example and test vectors

NameInputsAnswer
worked example{"which_given":"radius","value":7}circumference 43.98, area 153.94
test vector: given diameter{"which_given":"diameter","value":10}circumference 31.42, area 78.54

Published card