1 // Copyright 2017 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.
13 use core::num::flt2dec::strategy::dragon::*;
17 fn bench_small_shortest(b: &mut Bencher) {
18 let decoded = decode_finite(3.141592f64);
19 let mut buf = [0; MAX_SIG_DIGITS];
20 b.iter(|| format_shortest(&decoded, &mut buf));
24 fn bench_big_shortest(b: &mut Bencher) {
25 let decoded = decode_finite(f64::MAX);
26 let mut buf = [0; MAX_SIG_DIGITS];
27 b.iter(|| format_shortest(&decoded, &mut buf));
31 fn bench_small_exact_3(b: &mut Bencher) {
32 let decoded = decode_finite(3.141592f64);
34 b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
38 fn bench_big_exact_3(b: &mut Bencher) {
39 let decoded = decode_finite(f64::MAX);
41 b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
45 fn bench_small_exact_12(b: &mut Bencher) {
46 let decoded = decode_finite(3.141592f64);
47 let mut buf = [0; 12];
48 b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
52 fn bench_big_exact_12(b: &mut Bencher) {
53 let decoded = decode_finite(f64::MAX);
54 let mut buf = [0; 12];
55 b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
59 fn bench_small_exact_inf(b: &mut Bencher) {
60 let decoded = decode_finite(3.141592f64);
61 let mut buf = [0; 1024];
62 b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));
66 fn bench_big_exact_inf(b: &mut Bencher) {
67 let decoded = decode_finite(f64::MAX);
68 let mut buf = [0; 1024];
69 b.iter(|| format_exact(&decoded, &mut buf, i16::MIN));