1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(core_intrinsics)]
13 use std
::intrinsics
::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast}
;
16 pub fn test_operations(a
: f64, b
: f64) {
17 // make sure they all map to the correct operation
19 assert_eq
!(fadd_fast(a
, b
), a
+ b
);
20 assert_eq
!(fsub_fast(a
, b
), a
- b
);
21 assert_eq
!(fmul_fast(a
, b
), a
* b
);
22 assert_eq
!(fdiv_fast(a
, b
), a
/ b
);
23 assert_eq
!(frem_fast(a
, b
), a
% b
);
28 test_operations(1., 2.);
29 test_operations(10., 5.);