float_pattern = re.compile(r'[+-]?(?:(?:\d+\.?)|(?:\d*.\d+))(?:[Ee][+-]?\d+)')
def split_units(string):
match = float_pattern.match(string)
if match is None: raise ValueError('not a float')
num = float(match.group())
units = string[match.end():].strip()
return num, units