Function polars::export::arrow::compute::arithmetics::basic::wrapping_negate
source · [−]pub fn wrapping_negate<T>(array: &PrimitiveArray<T>) -> PrimitiveArray<T> where
T: NativeType + WrappingNeg,
This is supported on crate feature
compute_arithmetics
only.Expand description
Wrapping negates values from array.
Examples
use arrow2::compute::arithmetics::basic::wrapping_negate;
use arrow2::array::{Array, PrimitiveArray};
let a = PrimitiveArray::from([None, Some(6), Some(i8::MIN), Some(7)]);
let result = wrapping_negate(&a);
let expected = PrimitiveArray::from([None, Some(-6), Some(i8::MIN), Some(-7)]);
assert_eq!(result, expected);