How do I get an absolute value in Rust?
rust
Solution
Nowadays, `abs` is a method on most number types.
let value = -42i32;
let x = value.abs();
Problem
The docs are unhelpful: http://web.mit.edu/rust-lang_v0.9/doc/std/num/fn.abs.html Obviously, I can see the function right there, but I haven't got the faintest idea how to call it. Edit: The problem is that it doesn't work. :) ``` use std::num; let x = num::abs(value); ``` "Unresolved name: num::abs" Edit 2: running the nightly from yesterday (11/26/2014); I don't know what version. I didn't realize those docs were so outdated. oO Current docs seem to indicate there is no such function?