replaced GPL code in arithmetics