Translating IS operator to the best possible operator depending on value