I257Trait
Fully qualified path: alexandria_math::i257::I257Trait
#![allow(unused)] fn main() { pub trait I257Trait }
Trait functions
new
Creates a new i257 from an absolute value and sign. Ensures zero is always represented as positive.
Arguments
abs
- The absolute value as a u256is_negative
- Whether the number is negative
Returns
i257
- The constructed signed integer
Fully qualified path: alexandria_math::i257::I257Trait::new
#![allow(unused)] fn main() { fn new(abs: u256, is_negative: bool) -> i257 }
is_negative
Returns whether the i257 is negative.
Arguments
self
- The i257 to check
Returns
bool
- true if negative, false if positive or zero
Fully qualified path: alexandria_math::i257::I257Trait::is_negative
#![allow(unused)] fn main() { fn is_negative(self: i257) -> bool }
abs
Returns the absolute value of the i257.
Arguments
self
- The i257 to get absolute value from
Returns
u256
- The absolute value
Fully qualified path: alexandria_math::i257::I257Trait::abs
#![allow(unused)] fn main() { fn abs(self: i257) -> u256 }