Topic: Expressions

Online Help


Calcpad provides a comprehensive support for physical units of measurement. The current version, supports metric (SI and compatible), US and Imperial units. There are seven basic units that correspond to the seven physical dimensions:

  • mass - kilogram (kg)
  • length - meter (m)
  • time - second (s)
  • electric current - ampere (A)
  • temperature - degree Celsius (°C)
  • amount of substance - mole (mol)
  • luminous intensity - candela (cd)

All other units are derivative. They are obtained by the respective laws of physics. For example, force = mass·acceleration, so Newton is obtained by N = kg·m/s2. Multiples of units are also supported by adding the respective prefixes to units names. For example, kN = 103N, MN = 106N and so on.

You can attach units to numbers by typing the unit name after the value, e.g. 15kg. Then, you can use them in expressions, just like any other values. Unit cancellation and conversion is performed automatically during calculations. For example, the following expression will be evaluated as:

1.23m + 35cm + 12mm = 1.59m(and not: 1.23 + 35 + 12 = 48.23)

The result is usually obtained into the first unit in the expression. If you want to use particular units, write a vertical bar "|" followed by the target units at the end:

1.23m + 35cm + 12mm|cm

The above expression will evaluate to 159.2cm. If you simply want to convert units, just write the source and the target units, separated by a vertical bar, like: mm|cm or 10m/s|km/h.

Unit consistency is also verified automatically. For example, you cannot add m and s(e.g. 6m + 2s), but you can multiply and divide them 6m/2s = 3m/s.

Arguments for trigonometric, hyperbolic, logarithmic and exponential functions, must be unitless by definition. However, you can use units an any custom defined functions, if it makes any sense. You can also attach units to variables. If you specify the target units in a variable definition, they will be stored permanently inside the variable. Then, the selected units will be used further in the calculations with the respective value. In the next example, speed is calculated in m/s, but it is converted and stored as km/h:

Code Output
'Distance -'s_1 = 50m
'Time -'t_1 = 2s
'Speed -'V = s_1/t_1|km/h
'What distance you will travel for't_2 = 5s'?
s _2 = V*t_2|m
Distance - s1 = 50m
Time - t1 = 2s
Speed - V = s1/t1 = 50m/2s = 90km/h
What distance you will travel for t2 = 5s ?
s2 = V·t2 = 90km/h·5s = 125m

Calcpad includes a large collection of predefined units as follows:

Metric units (SI and compatible):

  • Mass: g, hg, kg, t, kt, Mt, Gt, dg, cg, mg, μg, ng, pg, Da, u;
  • Length: m, km, dm, cm, mm, μm, nm, pm, AU, ly;
  • Time: s, ms, μs, ns, ps, min, h, d;
  • Frequency: Hz, kHz, MHz, GHz, THz, mHz, μHz, nHz, pHz, rpm;
  • Velocity: kmh;
  • Electric current: A, kA, MA, GA, TA, mA, μA, nA, pA;
  • Temperature: °C, Δ°C, K;
  • Amount of substance: mol;
  • Luminous intensity: cd;
  • Area: a, daa, ha;
  • Volume: L, mL, cL, dL, hL;
  • Force: dyn N, daN, hN, kN, MN, GN, TN, kgf, tf;
  • Moment: Nm, kNm;
  • Pressure: Pa, daPa, hPa, kPa, MPa, GPa, TPa, dPa, cPa, mPa, μPa, nPa, pPa, bar, mbar, μbar, atm, at, Torr, mmHg;
  • Energy work: J, kJ, MJ, GJ, TJ, mJ, μJ, nJ, pJ, Wh, kWh, MWh, GWh, TWh, cal, kcal, erg, eV, keV, MeV, GeV, TeV, PeV, EeV;
  • Power: W, kW, MW, GW, TW, mW, μW, nW, pW, hpM, ks;
  • Electric charge: C, kC, MC, GC, TC, mC, μC, nC, pC, Ah, mAh;
  • Potential: V, kV, MV, GV, TV, mV, μV, nV, pV;
  • Capacitance: F, kF, MF, GF, TF, mF, μF, nF, pF;
  • Resistance: Ω, , , , , , μΩ, , ;
  • Conductance: S, kS, MS, GS, TS, mS, μS, nS, pS;
  • Magnetic flux: Wb , kWb, MWb, GWb, TWb, mWb, μWb, nWb, pWb;
  • Magnetic flux density: T, kT, MT, GT, TT, mT, μT, nT, pT;
  • Inductance: H, kH, MH, GH, TH, mH, μH, nH, pH;
  • Luminous flux: lm;
  • Illuminance: lx;
  • Radioactivity: Bq, kBq, MBq, GBq, TBq, mBq, μBq, nBq, pBq, Ci, Rd;
  • Absorbed dose: Gy, kGy, MGy, GGy, TGy, mGy, μGy, nGy, pGy;
  • Equivalent dose: Sv, kSv, MSv, GSv, TSv, mSv, μSv, nSv, pSv;
  • Catalytic activity: kat;

Non-metric units (Imperial/US):

  • Mass: gr, dr, oz, lb, kip, st, qr, cwt, cwtUK, cwtUS, ton, tonUK, tonUS, slug;
  • Length: th, in, ft, yd, ch, fur, mi, ftm, cable, nmi, li, rod, pole, perch, lea;
  • Speed: mph;
  • Temperature: °F, Δ°F, °R;
  • Area: rood, ac;
  • Volume (fluid): fl_oz, gi, pt, qt, gal, bbl, (dry) bu;
             fl_ozUK, giUK, ptUK, qtUK, galUK, bblUK, (dry) buUK;
             fl_ozUS, giUS, ptUS, qtUS, galUS, bblUS, (dry) buUS;
  • Force: ozf, lbf, kipf, tonf, pdl;
  • Pressure: osi, osf psi, psf, ksi, ksf, tsi, tsf, inHg;
  • Energy/work: BTU, therm, thermUK, thermUS, quad;
  • Power: hp, hpE, hpS