workaround promotion and overflow for sqr