optimize for doubles