Add function aliases for float operators

This commit is contained in:
Matt Brubeck 2011-10-27 07:02:40 -07:00 committed by Brian Anderson
parent 361adf9f86
commit 8dba51b87c

View file

@ -223,6 +223,36 @@ fn neg_infinity() -> float {
ret -1./0.;
}
pure fn add(x: float, y: float) -> float { ret x + y; }
pure fn sub(x: float, y: float) -> float { ret x - y; }
pure fn mul(x: float, y: float) -> float { ret x * y; }
pure fn div(x: float, y: float) -> float { ret x / y; }
pure fn rem(x: float, y: float) -> float { ret x % y; }
pure fn lt(x: float, y: float) -> bool { ret x < y; }
pure fn le(x: float, y: float) -> bool { ret x <= y; }
pure fn eq(x: float, y: float) -> bool { ret x == y; }
pure fn ne(x: float, y: float) -> bool { ret x != y; }
pure fn ge(x: float, y: float) -> bool { ret x >= y; }
pure fn gt(x: float, y: float) -> bool { ret x > y; }
pure fn positive(x: float) -> bool { ret x > 0.; }
pure fn negative(x: float) -> bool { ret x < 0.; }
pure fn nonpositive(x: float) -> bool { ret x <= 0.; }
pure fn nonnegative(x: float) -> bool { ret x >= 0.; }
//
// Local Variables:
// mode: rust