use transc;
use std::fmt::Display;
use std::convert;
use std::ops;
use std::str;
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
pub enum Sign {
Negative = -1,
Zero = 0,
Positive = 1,
}
pub trait From<T> {
fn from_lo(T, precision: usize) -> Self;
fn from_hi(T, precision: usize) -> Self;
}
pub trait FromStr: Sized + str::FromStr {
fn from_str_lo(s: &str, usize) -> Result<Self, Self::Err> { Self::from_str(s) }
fn from_str_hi(s: &str, usize) -> Result<Self, Self::Err> { Self::from_str(s) }
}
pub trait Into<T> {
fn into_lo(self) -> T;
fn into_hi(self) -> T;
}
pub trait MinMax {
fn min(self, rhs: Self) -> Self;
fn max(self, rhs: Self) -> Self;
}
pub trait Abs {
fn abs(self) -> Self;
}
pub trait Add: Sized + ops::Add<Output=Self> {
fn add_lo(self, rhs: Self) -> Self { self + rhs }
fn add_hi(self, rhs: Self) -> Self { self + rhs }
}
pub trait Sub: Sized + ops::Sub<Output=Self> {
fn sub_lo(self, rhs: Self) -> Self { self - rhs }
fn sub_hi(self, rhs: Self) -> Self { self - rhs }
}
pub trait Mul: Sized + ops::Mul<Output=Self> {
fn mul_lo(self, rhs: Self) -> Self { self * rhs }
fn mul_hi(self, rhs: Self) -> Self { self * rhs }
}
pub trait Div: Sized + ops::Div<Output=Self> {
fn div_lo(self, rhs: Self) -> Self { self / rhs }
fn div_hi(self, rhs: Self) -> Self { self / rhs }
}
pub trait Transc: Sized + transc::Transc<Output=Self> {
fn log_lo(self) -> Self { self.log() }
fn log_hi(self) -> Self { self.log() }
fn exp_lo(self) -> Self { self.exp() }
fn exp_hi(self) -> Self { self.exp() }
fn pow_lo(self, rhs: Self) -> Self { self.pow(rhs) }
fn pow_hi(self, rhs: Self) -> Self { self.pow(rhs) }
}
pub trait Float: convert::From<f64> + str::FromStr +
Clone + Display + Into<f64> + PartialOrd +
From<f64> + FromStr +
ops::Neg<Output=Self> + Abs + Add + Sub + Mul + Div + MinMax + Transc
{
fn zero(precision: usize) -> Self;
fn neg_zero(precision: usize) -> Self;
fn one(precision: usize) -> Self;
fn infinity(precision: usize) -> Self;
fn neg_infinity(precision: usize) -> Self;
fn nan(precision: usize) -> Self;
fn sign(&self) -> Sign;
fn precision(&self) -> usize;
fn is_finite(&self) -> bool;
fn is_infinite(&self) -> bool;
fn is_zero(&self) -> bool;
fn is_infinity(&self) -> bool;
fn is_neg_infinity(&self) -> bool;
fn is_nan(&self) -> bool;
}