typecasted inifinity assignments to make implementation more flexible across platforms