Search:

Type: Posts; User: ghostheadx

Search: Search took 0.06 seconds.

  1. Replies
    10
    Views
    4,547

    Re: school assignment; decimal rounding

    Here's my code:




    b = a + (5 * Math.pow(10, -d));
    b *= Math.pow(10, d);
    b = Math.round(b * d);
    b /= Math.pow(10, d);
  2. Replies
    10
    Views
    4,547

    Re: school assignment; decimal rounding

    4.637 rounded would be 4.64.

    --- Update ---

    I'll see what he says. I sent him an email. If he says "no" which I believe he won't, what would you say to do?
  3. Replies
    10
    Views
    4,547

    Re: school assignment; decimal rounding

    I don't think he wants me to use Math.round() because he's never taught me that before. Are you sure there's no way to do it with casting? I know it works for one decimal place.
  4. Replies
    10
    Views
    4,547

    Re: school assignment; decimal rounding

    @summit45 Thanks for the help. I would really appreciate more experienced advice though. But you can still help. :)
  5. Replies
    10
    Views
    4,547

    school assignment; decimal rounding

    Hi, I've been trying to get this problem to work for two days for my school. I'm just starting computer science class in Java. I really really really need help on my code. I've sent the teacher an...
Results 1 to 5 of 5