Calculation & Conversion Cheat Sheet

Percentages, compound interest, statistics, unit conversion — simple on the surface, yet the same traps recur: a base that moved, a metric that mismatched, a unit that slipped. This page tabulates six common calculations by purpose, use case and pitfall, with anchor points for all three temperature scales.

How It Works

Numeric computing splits "mathematically exact" from "what the computer stores". Floating point (IEEE 754 double) approximates decimals in binary, so 0.1 + 0.2 ≠ 0.3; money must use integer cents or a decimal library to stop error drift.

Base conversion (binary/octal/decimal/hex) is just expansion by weight and repeated remainder; unit conversion must mind dimensions (1 KiB = 1024 B vs 1 KB = 1000 B, the IEC/SI split). Operator precedence and parentheses change results, so expression parsing needs an explicit order.

When to Use This Table

This table is for doing numerical computation, statistical analysis or unit conversion. It covers percentages, growth rates, dispersion, sampling and estimation, with what each does, when to use it and common pitfalls. Define the problem type before choosing.

When not to consult it: you are choosing symbolic computation, matrix algorithms or numerical analysis methods. This table covers common statistics and conversions in everyday data analysis, not algorithmic complexity or numerical stability.

Rule of thumb: separate descriptive from inferential statistics. The former describes data at hand (mean, median, variance), the latter infers about a population from a sample (confidence intervals, hypothesis tests). Confusing them invites over-interpretation — a 95% confidence interval computed over 30 users is statistically almost meaningless.

Mind that a mean may not represent the data: means are sensitive to outliers, and in skewed distributions medians and quantiles are more robust. For example, if user ratings average 4.2 but 70% gave 2 and 30% gave 5, the median of 2 is the honest summary.

Boundaries and Common Pitfalls

  • Averages mislead on skewed distributions

    Reporting average income, average response time or average session duration as if it were typical is skewed by a few extreme values. The test is direct: compare median and mean — a large gap means skew, so report the median and quartiles; a small gap makes the mean usable. A real case: mean session 8 minutes with median 40 seconds means a few long sessions while most leave quickly, and using the mean hides that core finding.

  • Growth rates need an explicit base; "grew 10x" is routinely ambiguous

    Going from 100 to 200 can be described as 100% growth or as doubling, and "grew 10x" means eleven-fold in one reading and ten-fold in another. Standard practice is to use a multiplier (2x) rather than "times growth", and always state the base period alongside year-over-year or period-over-period figures. When comparing periods also confirm they are the same length — 7-day and 30-day figures are not comparable.

  • Percentages on small samples mislead decisions

    Three of ten users churning sounds serious, yet the 95% confidence interval is roughly 11% to 60% — the true value could be a third of that. With samples under 100, percentage uncertainty often exceeds the number itself. Practical guidance: for internal decisions use absolute counts and label the sample size; for external communication give a range rather than a point estimate; for metrics like conversion, phrase them as "conversion over at least N impressions" so the denominator is explicit.

How This Relates to Neighbours

To actually compute these statistics, use the in-site calculators; this page is a method selection reference.

Designing A/B tests and statistical tests belongs to experiment methodology, which requires metrics and sample size to be settled first.

Time series forecasting and modelling is advanced statistical work, out of scope here.

If the goal is explaining a specific number, establish its base period, sample size and distribution shape before concluding anything.

Practical Snippet

Key points: (1) means are sensitive to outliers — in skewed distributions the median and quartiles are the honest summary, and the test is the gap between mean and median; (2) growth must state its base period, use a multiplier (2x) rather than "times growth", and keep comparison periods the same length (7-day and 30-day are not comparable); (3) on small samples (n < 100) percentage uncertainty exceeds the number itself, so 30% may really be 11%–60% and a range beats a point estimate; (4) separate descriptive from inferential statistics — a 95% confidence interval over 30 users is statistically almost meaningless.

// ① 描述统计:偏斜分布用中位数,均值会被极端值拉高
function describe(values) {
  const sorted = [...values].sort((a, b) => a - b)
  const sum = values.reduce((a, b) => a + b, 0)
  const mean = sum / values.length
  const median = sorted.length % 2
    ? sorted[(sorted.length - 1) / 2]
    : (sorted[sorted.length / 2 - 1] + sorted[sorted.length / 2]) / 2
  // 均值与中位数的差距大 ⇒ 分布偏斜 ⇒ 以中位数汇报
  const skewed = Math.abs(mean - median) > Math.abs(median) * 0.1
  return { mean, median, skewed, reported: skewed ? median : mean }
}
console.log(describe([2, 2, 2, 2, 2, 2, 2, 2, 2, 40]))   // skewed: true

// ② 增长:写清基期,用倍数而非「倍增长」
function growth(from, to) {
  return {
    from, to,
    multiple: (to / from).toFixed(2) + 'x',           // 2.00x
    percentChange: (((to - from) / from) * 100).toFixed(1) + '%',
  }
}
console.log(growth(100, 200))    // { multiple: '2.00x', percentChange: '100.0%' }

// ③ 小样本百分比:给区间而不是点估计(Wilson 区间近似)
function wilson(successes, n, z = 1.96) {
  const p = successes / n
  const d = 1 + z * z / n
  const c = (p + z * z / (2 * n)) / d
  const m = z * Math.sqrt((p * (1 - p) + z * z / (4 * n)) / n) / d
  return { low: (c - m), high: (c + m) }
}
const ci = wilson(3, 10)
console.log('3/10 的 95% 区间:', ci.low.toFixed(3), '~', ci.high.toFixed(3))
// 0.112 ~ 0.603  ⇒ 点估计 30% 的不确定性极大

// ④ 同比与环比要保证周期长度一致
function compare(current, previous) {
  return {
    percentChange: (((current - previous) / previous) * 100).toFixed(1) + '%',
    // 🔴 7 日与 30 日不可直接比,必须先归一化
    normalizedDaily: current / 7,
  }
}

// ⑤ 离散程度:标准差 vs 四分位距
function spread(values) {
  const sorted = [...values].sort((a, b) => a - b)
  const q = p => sorted[Math.floor(p * (sorted.length - 1))]
  const iqr = q(0.75) - q(0.25)
  const mean = values.reduce((a, b) => a + b, 0) / values.length
  const sd = Math.sqrt(values.reduce((a, b) => a + (b - mean) ** 2, 0) / values.length)
  return { sd: sd.toFixed(2), iqr, preferIQR: iqr > sd }   // 偏态分布用 IQR

Practical Notes

  • Binary floating point cannot do 0.1 + 0.2Neither value is exactly representable in IEEE 754 double precision, so the sum is 0.30000000000000004. Money and inventory must use integers in the minor unit or a decimal type, and comparisons should use an explicit tolerance rather than ===.
  • The denominator you pick for a percentage change decides the storyFalling from 100 to 80 is a 20% drop (denominator = original), but recovering to 100 is a 25% gain (denominator = current). Reports must state which denominator is used, or one dataset supports two opposite narratives.
  • Temperature conversion is affine, not proportionalCelsius to Fahrenheit is x * 9/5 + 32, which includes an offset, so 20 °C is not twice as warm as 10 °C. For any quantity whose zero is arbitrary (temperature, altitude, calendar years), settle the baseline before comparing ratios.

Data Sources

  • IEEE 754-2019 (floating-point arithmetic)
  • Standard mathematical and statistical definitions

Codes, names and definitions above come from public specifications; we claim no originality over the specification data itself. The arrangement, Chinese annotations and practical notes on this page are written by us.

Six Common Calculations

CalculationWhat It DoesTypical UseCommon Pitfall
PercentageShare, increase/decrease, original and discounted priceDiscounts, growth rates, completion rates+50% then −50% does not return to the original; the base changed
Expression EvaluatorEvaluate expressions with brackets and functionsQuick checks, applying a formula repeatedlyMind operator precedence and degrees versus radians
StatisticsMean, median, mode, variance and standard deviationCentral tendency and spread of a datasetThe mean is dragged by outliers; use the median for skewed data
Compound InterestInterest on interest per period, optionally with regular contributionsDeposits, loans, recurring investment returnsNominal APR is not the effective annual rate; check compounding frequency
Unit ConverterConvert length, mass, area, volume, speed and moreCross-border documents, engineering drawings, recipesUS and imperial gallons and ounces differ; confirm the system first
TemperatureConvert between Celsius, Fahrenheit and KelvinOven settings, weather reports, lab recordsTemperature is an interval quantity, not a ratio one; do not scale it directly

Temperature Anchor Points

Formulas: °F = °C × 9/5 + 32 and K = °C + 273.15. The table lists anchor points that are easy to memorise.

Reference PointCelsiusFahrenheitKelvin
Absolute zero-273.15-459.670
Water freezes032273.15
Room temperature2068293.15
Body temperature3798.6310.15
Water boils100212373.15
Moderate oven180356453.15

Frequently Asked Questions

Why does +50% followed by −50% not return to the original price?

Because the two calculations use different bases. Starting from 100, a 50% rise gives 150. A 50% fall then removes half of 150, which is 75, leaving 75 — a loss of 25. Whenever equal percentage moves are applied in opposite directions the result is always below the starting point, and the shortfall equals the square of the change (here 0.5 × 0.5 = 0.25, a 25% loss). Falling first and rising second produces the identical loss.

Should I report the mean, median or mode?

It depends on the distribution. Use the mean when the data is roughly symmetric with no outliers, since it uses every data point. Use the median when outliers or strong skew are present — income, house prices and response times are classic cases — because it resists extreme values and better represents the typical case. Use the mode for categorical data or when you need to know the most common value, such as the best-selling size. A useful habit: report the mean together with the median so readers can immediately judge whether the data is skewed.

Why do nominal APR and effective annual return differ?

The difference comes from compounding frequency. A 12% nominal APR compounded monthly means 1% per month; after a year that is 1.01 to the twelfth power, about 1.1268, so the effective annual rate is 12.68%, not 12%. The more frequent the compounding, the higher the effective rate; with continuous compounding it approaches e to the power r minus one. Always compare products on the effective annual basis — the nominal rate alone is misleading.

Why does converting Celsius to Fahrenheit also add 32?

The two scales have different zero points and different degree sizes. Celsius sets the freezing point of water at 0 and boiling at 100, split into 100 equal parts. Fahrenheit sets freezing at 32 and boiling at 212, split into 180 parts. A Fahrenheit degree is therefore 100/180, or 5/9, of a Celsius degree. Converting requires scaling by 9/5 first and then shifting by 32 to align the zeros: °F = °C × 9/5 + 32. Kelvin simply moves the zero to absolute zero while keeping the Celsius step size, so you only subtract 273.15.