Computer Science Canada

Decimal Rounding

Author:  MysticVegeta [ Fri Nov 25, 2005 7:29 pm ]
Post subject:  Decimal Rounding

Say I want to round to the second decimal space, Is there a function for it or do I have to create on manually.
Turing:
frealstr(x : real, y : int, z : int)

Author:  wtd [ Fri Nov 25, 2005 7:31 pm ]
Post subject: 

Java 1.5

Java:
String.format("%.2f", someFloatNumber)

Author:  MysticVegeta [ Sat Nov 26, 2005 11:29 am ]
Post subject: 

what do i need to import to make it work?

Author:  MysticVegeta [ Sat Nov 26, 2005 1:14 pm ]
Post subject: 

Sorry The edit button is not working for me.
I am using java 1.4.2 (ready), isnt there a premade function in 1.4?

Author:  rizzix [ Sat Nov 26, 2005 1:39 pm ]
Post subject: 

pre 1.5 u need to do this:
Java:
java.text.DecimalFormat df = new java.text.DecimalFormat("#.##");
String str_double = df.format(my_double);


: