Skip to content

Angles and trigonometry

Angle is a dimension. sin, cos, and tan take an angle: 30° (or 30 deg), 0.5 rad, or a plain number, which they read as radians. The inverse functions return an angle. Degrees, arcminutes and arcseconds show as °, ′ and ″, with no space before them.

sin(30°)
sin(30 deg)
sin(0.5 rad)
sin(pi/6)
cos(60 deg)
atan(1) to deg
6 m * sin(30 deg)
0.5 deg to dms
51°30′26″ to deg

dms shows degrees, minutes, and seconds.

FunctionNotes
sqrt, cube root, nth root(x, n)sqrt carries units: sqrt(9 m^2) is 3 m
abs, smaller, larger, clamp(x, lo, hi)keep their unit
earlier, laterthe earlier or later of two dates
floor, ceil, roundplain numbers
ln, exp, log, log10, log2log is base 10
gcd, lcm, modulowhole numbers
sin, cos, tan, asin, acos, atan, atan2(y, x)angles; atan2 keeps the quadrant and takes two quantities of one dimension, atan2(3 m, 4 m); solve for y: atan2(y, 4 m) = 45 deg works too

Constants: pi (also π), tau (also τ), e, golden ratio, speed of light, and standard gravity. More constants are one import away; see Imports.