mirror of https://github.com/Nonannet/copapy.git
abs dunder function added for values
This commit is contained in:
parent
369c279a68
commit
c2e10ec0cb
|
|
@ -220,6 +220,9 @@ class value(Generic[TNum], Net):
|
|||
def __rfloordiv__(self, other: NumLike) -> Any:
|
||||
return add_op('floordiv', [other, self])
|
||||
|
||||
def __abs__(self: TCPNum) -> TCPNum:
|
||||
return cp.abs(self) # type: ignore
|
||||
|
||||
def __neg__(self: TCPNum) -> TCPNum:
|
||||
if self.dtype == 'float':
|
||||
return cast(TCPNum, add_op('sub', [value(0.0, volatile=False), self]))
|
||||
|
|
|
|||
Loading…
Reference in New Issue