Skip to content

quantity

a number with a unit

1
# quantity: a number with a unit
2
5 km
3
# a unit power
4
5 m25 m^2
Example outputCtrl+Enter to run
1
# to converts
2
5 km to mi3.10686 mi
3
# * and / combine the units
4
100 km / 2 h50 km/h
Example outputCtrl+Enter to run
  • float convert to a float
  • frac show a number as a fraction, like 7/2, or as text rounded to the nearest 1/den, like “2 11/16 in”
  • range the integers from 0 up to n, or from a up to b, not including the end, or with a step the numbers or quantities between
  • abs the value without its sign, so -3 becomes 3
  • round round to the nearest whole number, or to digits decimal places
  • sig round to that many significant figures (digits counted from the first non-zero one)
  • floor round down to a whole number
  • ceil round up to a whole number
  • trunc drop the fractional part, rounding toward zero
  • sign -1 if x is negative, 0 if it’s zero, 1 if it’s positive
  • hypot the length of the long side of a right triangle with sides x and y, sqrt(x² + y²)
  • sum add up a list, units included
  • avg the mean (average), or with weights, the mean where each item counts as many times as its weight
  • product multiply all the items together
  • median the middle value once sorted, or with an even count, halfway between the middle two
  • variance how spread out the numbers are
  • stdev how spread out the numbers are, in the same units as them
  • geo_mean the geometric mean: the nth root of the product, the right average for growth factors
  • harmonic_mean the harmonic mean: the reciprocal of the average reciprocal, the right average for rates
  • rms the root mean square: the square root of the average of the squares
  • mad the median absolute deviation: the median distance from the median, a spread that outliers barely move
  • sem the standard error of the mean: the standard deviation divided by the square root of the count
  • iqr the interquartile range: the 75th percentile minus the 25th
  • sin the sine of an angle, in radians or an angle unit
  • cos the cosine of an angle, in radians or an angle unit
  • tan the tangent of an angle, in radians or an angle unit
  • atan2 the angle from the positive x axis to the point (x, y), from -180° to 180°
  • csc the cosecant of an angle, 1 / sin(x)
  • secant the secant of an angle, 1 / cos(x), not to be confused with sec for seconds
  • cot the cotangent of an angle, 1 / tan(x)
  • fixed x as text with exactly that many decimals, padding with zeros if needed
  • sci x as text in scientific notation, like 1.23e5 for 123000, with digits decimals
  • eng x as text in engineering notation, with the exponent a multiple of 3, like 123.457e6, with digits decimals
  • mixed_frac a number as a mixed fraction text, like “1 1/4” for 1.25, optionally rounded to the nearest 1/den
  • percent a fraction as percentage text, so 0.256 is “25.6%”, with digits decimals
  • commas x as text with commas between thousands, like “1,234,567”, with digits decimals
  • human_bytes a number of bytes as text in the largest binary unit that fits, like “117.7 MiB”, with one decimal
  • dms an angle as degrees, arcminutes and arcseconds text, like 52°20′24″
  • lat a latitude in degrees as text with N or S, like 7°19′48″S
  • lon a longitude in degrees as text with E or W, like 74°0′21″W
  • simplify the quantity in the prefix of its unit that reads best, like 3.6 kW instead of 3600 W
  • si the quantity in standard metric (SI) units
  • kind the kind of quantity, like length or force, or its SI units when the kind has no name
  • for_scale the quantity in whichever informal unit gives the easiest number to picture
  • bmi body mass index, mass divided by the square of height, in kg/m²
  • salary a pay rate as pay per hour, day, week, month and year
  • grow what money will be worth after time at the rate
  • present_value what a future sum, and any regular payments up to then, are worth today at the rate
  • apr the yearly rate quoted before compounding (annual percentage rate) that gives an effective yearly rate
  • npv the net present value of a list of cash flows: each is discounted by the rate for every period since the first, which is now
  • loan_rate the yearly rate of a loan from its monthly payment (the annual percentage rate, compounding monthly)
  • depreciation a schedule of how an asset loses value over its life, a row per year
  • cagr the steady yearly growth rate that would take start to end over time (compound annual growth rate)
  • doubling how long it takes money to double at the rate
  • apy the yearly rate you really earn once compounding is included (annual percentage yield)
  • real_rate what a return is really worth once inflation is taken out
  • payment the monthly payment that pays off a loan over time, interest included
  • payoff how long a regular payment takes to pay off a balance with interest, rounded up to whole payments
  • amortize a loan’s month-by-month schedule
  • share split a sum into parts, in equal shares or by the weights in a list, rounded to the cent so they still add up exactly
  • change how much a value changed, as a fraction of where it started
  • margin profit as a fraction of the selling price
  • markup profit as a fraction of what it cost you
  • parts a duration split into the largest units that fit, up to three of days, hours, minutes and seconds
  • hms a duration as clock text, like 7:15:00, with hours that can pass 24
  • depth_of_field the zone that looks sharp: {near, far, total, hyperfocal}, for lens focal length at aperture f focused at dist

Example results generated on 2026-11-04. Ones using now, today or randomness will differ when you run them.