Add neg() to the num iface
This commit is contained in:
parent
d8b113f209
commit
e158ce8a9d
@ -184,6 +184,7 @@ impl num of num for f32 {
|
||||
fn mul(&&other: f32) -> f32 { ret self * other; }
|
||||
fn div(&&other: f32) -> f32 { ret self / other; }
|
||||
fn modulo(&&other: f32) -> f32 { ret self % other; }
|
||||
fn neg() -> f32 { ret -self; }
|
||||
|
||||
fn to_int() -> int { ret self as int; }
|
||||
fn from_int(n: int) -> f32 { ret n as f32; }
|
||||
|
@ -205,6 +205,7 @@ impl num of num for f64 {
|
||||
fn mul(&&other: f64) -> f64 { ret self * other; }
|
||||
fn div(&&other: f64) -> f64 { ret self / other; }
|
||||
fn modulo(&&other: f64) -> f64 { ret self % other; }
|
||||
fn neg() -> f64 { ret -self; }
|
||||
|
||||
fn to_int() -> int { ret self as int; }
|
||||
fn from_int(n: int) -> f64 { ret n as f64; }
|
||||
|
@ -416,6 +416,7 @@ impl num of num for float {
|
||||
fn mul(&&other: float) -> float { ret self * other; }
|
||||
fn div(&&other: float) -> float { ret self / other; }
|
||||
fn modulo(&&other: float) -> float { ret self % other; }
|
||||
fn neg() -> float { ret -self; }
|
||||
|
||||
fn to_int() -> int { ret self as int; }
|
||||
fn from_int(n: int) -> float { ret n as float; }
|
||||
|
@ -129,6 +129,7 @@ impl num of num for T {
|
||||
fn mul(&&other: T) -> T { ret self * other; }
|
||||
fn div(&&other: T) -> T { ret self / other; }
|
||||
fn modulo(&&other: T) -> T { ret self % other; }
|
||||
fn neg() -> T { ret -self; }
|
||||
|
||||
fn to_int() -> int { ret self as int; }
|
||||
fn from_int(n: int) -> T { ret n as T; }
|
||||
|
@ -8,6 +8,7 @@ iface num {
|
||||
fn mul(&&other: self) -> self;
|
||||
fn div(&&other: self) -> self;
|
||||
fn modulo(&&other: self) -> self;
|
||||
fn neg() -> self;
|
||||
|
||||
fn to_int() -> int;
|
||||
fn from_int(n: int) -> self; // TODO: Static functions.
|
||||
|
@ -70,6 +70,7 @@ impl num of num for T {
|
||||
fn mul(&&other: T) -> T { ret self * other; }
|
||||
fn div(&&other: T) -> T { ret self / other; }
|
||||
fn modulo(&&other: T) -> T { ret self % other; }
|
||||
fn neg() -> T { ret -self; }
|
||||
|
||||
fn to_int() -> int { ret self as int; }
|
||||
fn from_int(n: int) -> T { ret n as T; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user