Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  traits.rs

  Sprache: Rust
 

use core::fmt::Display;
use core::ops::{Add, BitAnd, BitOr, BitOrAssign, BitXorAssign, Div, Mul, Shl, Shr, Sub};

pub trait Float: Copy {
    const MANTISSA_DIGITS: u32;
    const MIN_10_EXP: i32;
    const MAX_10_EXP: i32;
    const MAX_DIGITS10: u32;
}

impl Float for f32 {
    const MANTISSA_DIGITS: u32 = Self::MANTISSA_DIGITS;
    const MIN_10_EXP: i32 = Self::MIN_10_EXP;
    const MAX_10_EXP: i32 = Self::MAX_10_EXP;
    const MAX_DIGITS10: u32 = 9;
}

impl Float for f64 {
    const MANTISSA_DIGITS: u32 = Self::MANTISSA_DIGITS;
    const MIN_10_EXP: i32 = Self::MIN_10_EXP;
    const MAX_10_EXP: i32 = Self::MAX_10_EXP;
    const MAX_DIGITS10: u32 = 17;
}

pub trait UInt:
    Copy
    + From<u8>
    + From<bool>
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + Div<Output = Self>
    + BitAnd<Output = Self>
    + BitOr<Output = Self>
    + Shl<u8, Output = Self>
    + Shl<i32, Output = Self>
    + Shl<u32, Output = Self>
    + Shr<i32, Output = Self>
    + Shr<u32, Output = Self>
    + BitOrAssign
    + BitXorAssign
    + PartialOrd
    + Into<u64>
    + Display
{
    type Signed: Ord;
    fn wrapping_sub(self, other: Self) -> Self;
    fn truncate(big: u64) -> Self;
    fn enlarge(small: u32) -> Self;
    fn to_signed(self) -> Self::Signed;
}

impl UInt for u32 {
    type Signed = i32;
    fn wrapping_sub(self, other: Self) -> Self {
        self.wrapping_sub(other)
    }
    fn truncate(big: u64) -> Self {
        big as u32
    }
    fn enlarge(small: u32) -> Self {
        small
    }
    fn to_signed(self) -> Self::Signed {
        self as i32
    }
}

impl UInt for u64 {
    type Signed = i64;
    fn wrapping_sub(self, other: Self) -> Self {
        self.wrapping_sub(other)
    }
    fn truncate(big: u64) -> Self {
        big
    }
    fn enlarge(small: u32) -> Self {
        u64::from(small)
    }
    fn to_signed(self) -> Self::Signed {
        self as i64
    }
}

Messung V0.5 in Prozent
C=79 H=87 G=82

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=141584
#Domains=752002