// Copyright 2025 Gabriel Bjørnager Jensen.

#![cfg(test)]

use core::f32;
use core::f64;
use float_eq::float_eq;
use multitype::{Float, StdFloat};

#[test]
fn test_std_float() {
	fn op<T: StdFloat>(mut value: T) -> T {
		value  = value.cos();
		value *= T::from(-1i8);
		value *= T::E;
		value  = value.ln();

		value
	}

	fn error<T: Float>() -> T {
		T::from_f64_lossy(0.125)
	}

	let mut value0 = f32::consts::PI;
	let mut value1 = f64::consts::PI;

	value0 = op(value0);
	value1 = op(value1);

	assert!(float_eq!(value0, 1.0, abs <= error()));
	assert!(float_eq!(value1, 1.0, abs <= error()));
}
