Why is there no Abs trait in Std?

Why does Std have the Add, Div etc traits but not the Abs (absolute value) trait?

The traits exists mainly for the purpose of operator overloading. Since there is no operator for abs, there is no trait.

4 Likes

The num_traits crate has it (as part of its Signed trait).

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.