// Copyright 2025 Gabriel Bjørnager Jensen.

#![cfg(feature = "f128")]

mod test;

use crate::FloatLeast32;

use core::convert::Infallible;

/// Denotes a floating-point number that is at least as wide as [`f64`].
///
/// # Safety
///
/// Only primitive, floating-point types that fit the size requirement may implement this type.
pub trait FloatLeast64
where
	Self:
		crate::seal::FloatLeast64
		+ FloatLeast32
		+ From<f64>
		+ From<u32>
		+ From<i32>
		+ TryFrom<f64, Error = Infallible>
		+ TryFrom<u32, Error = Infallible>
		+ TryFrom<i32, Error = Infallible>,
{}

macro_rules! impl_float_least64 {
	{ $($Ty:ty),*$(,)? } => {$(
		#[cfg(feature = "f128")]
		impl ::multitype::seal::FloatLeast64 for $Ty {}

		#[cfg(feature = "f128")]
		#[cfg_attr(feature = "unstable-docs", doc(cfg(feature = "f128")))]
		impl ::multitype::FloatLeast64 for $Ty {}
	)*};
}

impl_float_least64! {
	f64,
	f128,
}
