Created
October 28, 2012 06:29
-
-
Save brendanzab/3967876 to your computer and use it in GitHub Desktop.
abs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pure fn abs<T:Copy Num Ord>(x: &T) -> T { | |
| if x >= from_int(0) { *x } else {-x } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ./src/math.rs:23:12: 23:20 error: failed to find an implementation of trait @core::num::Num for <V13> | |
| ./src/math.rs:23 if x >= from_int(0) { *x } else {-x } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment