Error codes

E0037: malformed unit of measure

In a terminal: auk explain E0037 prints this page.

On this page

A < written directly after a number or after int/float (no space) starts a unit of measure: 3.0<m/s>, float<kg*m/s^2>. A unit is names (or 1) joined by * and /, each with an optional integer power ^n (s^-1 is allowed). Anything else inside the brackets is an error.

Wrong#

auk
fn accel(): float<m/s^2> = 9.8<m/s**2>

Fixed#

auk
fn accel(): float<m/s^2> = 9.8<m/s^2>

Common causes#

  • Writing ** instead of ^ for a power inside a unit.
  • A comparison written without spaces, like 3<x>y: put spaces around < (3 < x).
  • Parentheses in a unit: write kg/m/s instead of kg/(m*s).

Stuck on a word? Try the glossary. Got a compiler error? Look up its code. Improve this page