Voici le code suivant:
Code : Tout sélectionner
int main(){
gen res;
gen g1(string("[[1+7e-16*s,1-7e-16*s,0],[1,0,1]]"),0);
cout << _rref(g1,0) << endl;
gen g2(string("[[a1*s+b1,c1-a1*s,0],[1,0,1]]"),0);
cout << _rref(g2,0) << endl;
return(0);
}
Code : Tout sélectionner
[[1.0,-0.0,1.0],[-0.0,1.0,-1]]
[[1,0,1],[0,1,(a1*s+b1)/(a1*s-c1)]]
a1 by 7e-16
b1 by 1
c1 by 1
But the result is not (7e-16*s+1)/(7e-16-1)
I think an approximation is done :
7e-16+1 ~1
7e-16-1 ~-1
That's why the result is -1
How to avoid that approximation ?
[/list]