From 8dba51b87c2889df2be4f9795fbec4179d94343d Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Thu, 27 Oct 2011 07:02:40 -0700 Subject: [PATCH] Add function aliases for float operators --- src/lib/float.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/lib/float.rs b/src/lib/float.rs index 04960c193b3..726ba8307b9 100644 --- a/src/lib/float.rs +++ b/src/lib/float.rs @@ -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