void erreur( int bits, double exact, double approx ) { if (exact==0) { throw Echec(1,"division par 0") ; } int erreur = arrondi(resolution_*(exact-approx)/exact) ; if (erreur<0) { erreur = -erreur ; } std::cout <<std::right<<std::setw(2)<<bits<<" bits : " <<std::left<<exact<<" ~ "<<approx <<" ("<<erreur<<"/"<<resolution_<<")" ; }
int fois_puissance_de_deux( int nombre, int exposant ) { if (nombre < 0) { throw Echec(1, "cas imprevu") ; } else if (exposant < 0) { return (nombre >> -exposant) ; } else if (nombre > (((unsigned int)(-1))>>exposant>>1))
Testeur * operator[]( int indice ) { if ((indice<0)||(indice>=indice_)) { throw Echec(3,"indice de testeur incorrect") ; } return testeurs_[indice] ; }
void acquiere( Testeur * pt ) { if (indice_==taille_) { throw Echec(2,"trop de testeurs") ; } testeurs_[indice_++] = pt ; }
// transformation d'un Coef en double operator double() { if (exposant_<0) { throw Echec(4,"exposant negatif") ; } return double(numerateur_)/fois_puissance_de_deux(1,exposant_) ; }