Fix for issue #149 - DivideByZero exception in linear model

Provides a safe-div function in core that handles division by zero for primitive types and updates linear-model to use it