]> AND Private Git Repository - cours-mesi.git/blob - tps/chap1/tpFlotant.java
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
j
[cours-mesi.git] / tps / chap1 / tpFlotant.java
1
2
3 class ErreurFlottant{
4     
5
6     public static void main(String args[]){
7         String nombres[] ={"1/7","Math.log(2)","Math.log10(2)","Math.sqrt(2)","Math.pow(2,1.0/3),Math.pi"};
8         System.out.println("1/7 &"+ 1.0/7+ "&" + (1.0/7 -0.14285714285714285)); 
9         System.out.println("ln(2) &"+ Math.log(2)+ "&" + (Math.log(2)-0.6931471805599453));
10         System.out.println("log(2) &"+ Math.log10(2)+ "&" + (Math.log10(2)-0.3010299956639812));                           
11         System.out.println("sqrt(2) &"+ Math.sqrt(2)+ "&" + (Math.sqrt(2)-1.4142135623730951));                            
12         System.out.println("3\\/-2 &"+ Math.pow(2,1.0/3)+ "&" + (Math.pow(2,1.0/3)-1.2599210498948732));                           
13         System.out.println("pi &"+ Math.PI+ "&" + (Math.PI-3.141592653589793));                            
14         
15     }
16 }
17                    
18
19
20