Skip to main content

APFloatType

Trait APFloatType 

Source
pub trait APFloatType: Type + FloatTypeInterface {
    // Required methods
    fn value_to_f64(&self, val: APFloat) -> f64;
    fn value_from_f64(&self, val: f64) -> APFloat;
    fn value_to_string(&self, val: APFloat) -> String;
    fn disp_value(
        &self,
        val: APFloat,
        ctx: &Context,
        state: &State,
        f: &mut Formatter<'_>,
    ) -> Result;
    fn parse_value<'a>(
        &self,
        state_stream: &mut StateStream<'a>,
    ) -> ParseResult<'a, APFloat>;

    // Provided method
    fn verify(_op: &dyn Type, _ctx: &Context) -> Result<()>
       where Self: Sized { ... }
}

Required Methods§

Source

fn value_to_f64(&self, val: APFloat) -> f64

Source

fn value_from_f64(&self, val: f64) -> APFloat

Source

fn value_to_string(&self, val: APFloat) -> String

Source

fn disp_value( &self, val: APFloat, ctx: &Context, state: &State, f: &mut Formatter<'_>, ) -> Result

Source

fn parse_value<'a>( &self, state_stream: &mut StateStream<'a>, ) -> ParseResult<'a, APFloat>

Provided Methods§

Source

fn verify(_op: &dyn Type, _ctx: &Context) -> Result<()>
where Self: Sized,

Trait Implementations§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl APFloatType for BFloat16Type

Source§

impl APFloatType for Float4E2M1Type

Source§

impl APFloatType for Float8E4M3Type

Source§

impl APFloatType for Float8E5M2Type

Source§

impl APFloatType for Float8E8M0Type

IeeeFloat::from_bits assumes the presence of a sign bit and will overflow when extracting this non-existent bit. So we need to do custom conversion here.

Source§

impl APFloatType for Float16Type

Source§

impl APFloatType for Float32Type

Source§

impl APFloatType for Float64Type

Source§

impl APFloatType for FloatFlex32Type

Source§

impl APFloatType for TFloat32Type