File: bellerophon_radix_tests.rs

package info (click to toggle)
rust-lexical-parse-float 1.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,012 kB
  • sloc: makefile: 2
file content (26 lines) | stat: -rw-r--r-- 1,126 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#![cfg(feature = "radix")]

mod bellerophon;

use bellerophon::bellerophon_test;
use lexical_util::format::NumberFormatBuilder;

const BASE3: u128 = NumberFormatBuilder::from_radix(3);

#[test]
fn bellerophon_radix_test() {
    // Checking the exact rounding of the digits close to 5e-324.
    bellerophon_test::<f64, { BASE3 }>(5, -640, false, 4172256988254845, 10);
    bellerophon_test::<f64, { BASE3 }>(2, -679, false, 0, 0);
    bellerophon_test::<f64, { BASE3 }>(3, -679, false, 1, 0);
    bellerophon_test::<f64, { BASE3 }>(6, -680, false, 0, 0);
    bellerophon_test::<f64, { BASE3 }>(7, -680, false, 1, 0);
    bellerophon_test::<f64, { BASE3 }>(20, -681, false, 0, 0);
    bellerophon_test::<f64, { BASE3 }>(21, -681, false, 1, 0);
    bellerophon_test::<f64, { BASE3 }>(61, -682, false, 0, 0);
    bellerophon_test::<f64, { BASE3 }>(62, -682, false, 1, 0);
    bellerophon_test::<f64, { BASE3 }>(184, -683, false, 0, 0);
    bellerophon_test::<f64, { BASE3 }>(185, -683, false, 1, 0);
    bellerophon_test::<f64, { BASE3 }>(554, -684, false, 0, 0);
    bellerophon_test::<f64, { BASE3 }>(555, -684, false, 1, 0);
}