github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/examples/gno.land/p/demo/int256/absolute.gno (about) 1 package int256 2 3 import ( 4 "gno.land/p/demo/uint256" 5 ) 6 7 // Abs returns |z| 8 func (z *Int) Abs() *uint256.Uint { 9 return z.abs.Clone() 10 } 11 12 // AbsGt returns true if |z| > x, where x is a uint256 13 func (z *Int) AbsGt(x *uint256.Uint) bool { 14 return z.abs.Gt(x) 15 } 16 17 // AbsLt returns true if |z| < x, where x is a uint256 18 func (z *Int) AbsLt(x *uint256.Uint) bool { 19 return z.abs.Lt(x) 20 }