use crate::float::SerdeFloat;
use crate::{ComparableFloatRef, Float};
use alloc::format;
use alloc::string::String;
use malachite_base::num::conversion::traits::FromStringBase;
impl From<Float> for SerdeFloat {
#[inline]
fn from(x: Float) -> Self {
Self(format!("{:#x}", ComparableFloatRef(&x)))
}
}
impl TryFrom<SerdeFloat> for Float {
type Error = String;
#[inline]
fn try_from(s: SerdeFloat) -> Result<Self, String> {
Self::from_string_base(16, &s.0).ok_or_else(|| format!("Unrecognized digits in {}", s.0))
}
}