I just noticed from system module:
    
    
    proc cmp*[T](x, y: T): int {.procvar.} =
      if x == y: return 0
      if x < y: return -1
      return 1
    

Looks very similar to sign() function above.

So maybe we should write that 
    
    
    (x > y).int - (x < y).int
    

Well, mayby gcc > 5.4 will do that automatically. I have only version 5.4 
currently. Fully untested!

Reply via email to