You should not use double/float when dealing with exact numbers, such as a calculator. You need to use BigDecimal.
On Apr 13, 2:18 am, Gabriel <[email protected]> wrote: > I resolved it using: > > double result = //old result// > *100 > > double newresult =(Math.round(result)); > > double finalresult = (newresult) / 100; > > On 12 abr, 14:29, Harsh J <[email protected]> wrote: > > > > > There is a DecimalFormat class generally available in Java. It can > > handle the precision amongst other things (like separator character > > based on locale, currency unit based on locale, etc.) while > > string-representing doubles. > > > Here's the full > > API:http://download.oracle.com/javase/6/docs/api/java/text/DecimalFormat.... > > > On Tue, Apr 12, 2011 at 10:25 PM, Gabriel <[email protected]> wrote: > > > I have a calculator app and I want to round the number after comma. > > > > Like, if the result is 15,33333 I want to keep it on 15,33 or 15,3 > > > > Does any know how to do that? > > > > Thanks, I really appreciate the help > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to [email protected] > > > To unsubscribe from this group, send email to > > > [email protected] > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > -- > > Harsh Jhttp://harshj.com- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

