3 Replies Latest reply on Jan 24, 2008 8:27 AM by Craig D.

    rounding numbers up or down on decimal integrer

    reinhat
      Hi,
      I have a challenging issue because Math.ceil and Math.floor rounds numbers to a whole number.

      I am creating a dosage calculator and unfortunately I need to follow and produce existing values present on a printed sheet where the rounding does not happened in a straightforward manner. So I need to be able to round the numbers up or down in order to match existing values on the printed data sheet.

      In one case, I have 6.251 as a result and I need to round it up to 6.3
      In another case, I have 52.508 as a result and I need to round it down to 52.5

      How can I accomplish this?
      Thank you in advance.
      Attila