Add signum.

This commit is contained in:
Danila Fedorin 2020-12-07 17:04:48 -08:00
parent 75a318c567
commit 44b60114a1
1 changed files with 7 additions and 0 deletions

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