Resources Numerical accuracy Calculation policy

IFC measures in SI for USD

Converts IFC lengths, areas and volumes to meters, square meters and cubic meters when properties are written to USD.

How the precision is kept

One 64-bit multiplication by the file length factor, squared for area and cubed for volume. The unit factor comes from the file.

Calculations under this policy

1 calculation in 1 source file. The code is read from the released app when this page loads. It is the calculation people run, not a copy kept for this page.

usd/ifc.js CadCraft 0.8.2 64-bit 1 calculation Reviewed

Tests None found by the review

Measure to SI

64-bit

A property value in meters, square meters or cubic meters.

area = v × L²; volume = v × L³

Multiplies by lengthToMetre, lengthToMetre ** 2 or lengthToMetre ** 3 in 64-bit, so the unit factor is applied after it is raised to the power, not to the value each time.

  • usd/ifc.js
  • lines 43 to 51
  • CadCraft 0.8.2
export function siValue(type, value, lengthToMetre = 1) {
  if (typeof value !== 'number' || !Number.isFinite(value)) return null;
  const T = String(type || '').toUpperCase();
  if (LEN.test(T) || T === 'LENGTH') return { value: value * lengthToMetre, unit: 'm' };
  if (T === 'IFCAREAMEASURE' || T === 'AREA') return { value: value * lengthToMetre ** 2, unit: 'm2' };
  if (T === 'IFCVOLUMEMEASURE' || T === 'VOLUME') return { value: value * lengthToMetre ** 3, unit: 'm3' };
  if (T === 'IFCMASSMEASURE' || T === 'WEIGHT') return { value, unit: 'kg' };
  return null;
}

In detail

Method
value × L, value × L², value × L³ with L = length unit in meters; mass is passed as kg without conversion.
Number types
64-bit numbers; the result is written as a double.
Tolerances
None.
Limits
Only length, area, volume and mass measures are converted; other measures return null and are written as they are. Mass is taken to be in kg already.

Approach: 64-bit, direct

Every value is a 64-bit number from input to result. Formulas are closed form or a direct solve, and every comparison uses a stated tolerance.

Every policy that takes this approach