Add signum.

This commit is contained in:
Danila Fedorin 2020-12-07 17:04:48 -08:00
parent 75a318c567
commit 44b60114a1

View File

@ -49,3 +49,10 @@ struct Tuple(*T)
{ self[0]//gcd, self[1]//gcd}
end
end
struct Number
def signum
return 0 if self == 0
self // self.abs
end
end