if (sscanf(str, "%lf%n", &x, &read_chars) != 1)
msg = "Invalid number";
else if (u = lookup_unit(str, str + read_chars, &msg))
if (sscanf(str, "%lf%n", &x, &read_chars) != 1)
msg = "Invalid number";
else if (u = lookup_unit(str, str + read_chars, &msg))