Rewrote newton to only be defined for floating point types