Monday, 21 March 2016

Rounding Double/Float values till 1 & 2 Decimal values in TALEND thru Math.round

Rounding double/float  till 1 decimal value 

1) Math.round(x)

Prints
10.5 rounded is 11
10.499999999999998 rounded is 10
9.5 rounded is 10
9.499999999999998 rounded is 9
8.5 rounded is 9
8.499999999999998 rounded is 8
7.5 rounded is 8

7.499999999999999 rounded is 7

Rounding double/float till 2 Decimal values

Eg:
double kilobytes = 1205.6358;

System.out.println("kilobytes : " + kilobytes);

double newKB = Math.round(kilobytes*100.0)/100.0;

System.out.println("kilobytes (Math.round) : " + newKB);


Output :
=======

kilobytes : 1205.6358
kilobytes (Math.round) : 1205.64



get it

 http://hinekv1.ddns.net:8008/get.php?username=Varga_Florentina1tv&password=j5MgWBs18t&type=m3u_plus&output=mpegts http://www.lo...