fix infinity usage in math