Added double type to optimizeTypeOf