1 #![feature(core_intrinsics)]
3 use std::intrinsics::{fadd_fast, fdiv_fast, fmul_fast, frem_fast, fsub_fast};
6 pub fn test_operations_f64(a: f64, b: f64) {
7 // make sure they all map to the correct operation
9 assert_eq!(fadd_fast(a, b), a + b);
10 assert_eq!(fsub_fast(a, b), a - b);
11 assert_eq!(fmul_fast(a, b), a * b);
12 assert_eq!(fdiv_fast(a, b), a / b);
13 assert_eq!(frem_fast(a, b), a % b);
18 pub fn test_operations_f32(a: f32, b: f32) {
19 // make sure they all map to the correct operation
21 assert_eq!(fadd_fast(a, b), a + b);
22 assert_eq!(fsub_fast(a, b), a - b);
23 assert_eq!(fmul_fast(a, b), a * b);
24 assert_eq!(fdiv_fast(a, b), a / b);
25 assert_eq!(frem_fast(a, b), a % b);
30 test_operations_f64(1., 2.);
31 test_operations_f64(10., 5.);
32 test_operations_f32(11., 2.);
33 test_operations_f32(10., 15.);