Move approximate equality test for floats to util
This commit is contained in:
parent
beaaa597d4
commit
995eaec555
@ -0,0 +1,4 @@
|
|||||||
|
pub fn approx_equal(a: f64, b: f64, dp: u8) -> bool {
|
||||||
|
let p = 10f64.powi(-(dp as i32));
|
||||||
|
(a - b).abs() < p
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
pub mod cli_arguments;
|
pub mod cli_arguments;
|
||||||
|
pub mod f64_utils;
|
||||||
pub mod file_util;
|
pub mod file_util;
|
||||||
pub mod hash_util;
|
pub mod hash_util;
|
||||||
pub mod lexicographic_file_walker;
|
pub mod lexicographic_file_walker;
|
||||||
|
@ -5,8 +5,9 @@ mod common;
|
|||||||
use cheap_ruler::CheapRuler;
|
use cheap_ruler::CheapRuler;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use common::{
|
use common::{
|
||||||
cli_arguments::Args, hash_util::md5_of_osrm_executables, nearest_response::NearestResponse,
|
cli_arguments::Args, f64_utils::approx_equal, hash_util::md5_of_osrm_executables,
|
||||||
osm::OSMWay, osrm_world::OSRMWorld, task_starter::TaskStarter,
|
nearest_response::NearestResponse, osm::OSMWay, osrm_world::OSRMWorld,
|
||||||
|
task_starter::TaskStarter,
|
||||||
};
|
};
|
||||||
use core::panic;
|
use core::panic;
|
||||||
use cucumber::{self, gherkin::Step, given, when, World};
|
use cucumber::{self, gherkin::Step, given, when, World};
|
||||||
|
Loading…
Reference in New Issue
Block a user