Complete conversion of calc_num module