Improve convert_from_reference_voltage in calculate.c