Skip to content

Commit 8dba51b

Browse files
mbrubeckbrson
authored andcommitted
Add function aliases for float operators
1 parent 361adf9 commit 8dba51b

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/lib/float.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,36 @@ fn neg_infinity() -> float {
223223
ret -1./0.;
224224
}
225225

226+
pure fn add(x: float, y: float) -> float { ret x + y; }
227+
228+
pure fn sub(x: float, y: float) -> float { ret x - y; }
229+
230+
pure fn mul(x: float, y: float) -> float { ret x * y; }
231+
232+
pure fn div(x: float, y: float) -> float { ret x / y; }
233+
234+
pure fn rem(x: float, y: float) -> float { ret x % y; }
235+
236+
pure fn lt(x: float, y: float) -> bool { ret x < y; }
237+
238+
pure fn le(x: float, y: float) -> bool { ret x <= y; }
239+
240+
pure fn eq(x: float, y: float) -> bool { ret x == y; }
241+
242+
pure fn ne(x: float, y: float) -> bool { ret x != y; }
243+
244+
pure fn ge(x: float, y: float) -> bool { ret x >= y; }
245+
246+
pure fn gt(x: float, y: float) -> bool { ret x > y; }
247+
248+
pure fn positive(x: float) -> bool { ret x > 0.; }
249+
250+
pure fn negative(x: float) -> bool { ret x < 0.; }
251+
252+
pure fn nonpositive(x: float) -> bool { ret x <= 0.; }
253+
254+
pure fn nonnegative(x: float) -> bool { ret x >= 0.; }
255+
226256
//
227257
// Local Variables:
228258
// mode: rust

0 commit comments

Comments
 (0)