use crate::{Extended, Flags};
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Payload {
pub negative: bool,
pub signalling: bool,
pub fraction: u64,
}
pub trait NanPolicy<T> {
const DEFAULT: T;
fn is_signalling(value: T) -> bool;
fn quiet(value: T) -> (T, Flags);
fn choose(first: T, second: T) -> (T, Flags);
fn export(value: T) -> Payload;
fn import(payload: Payload) -> (T, Flags);
}
impl Extended {
pub fn propagate_nan<N: NanPolicy<Extended>>(self, other: Extended) -> (Extended, Flags) {
N::choose(self, other)
}
}