1. Check out our companion app, Forums for Android! Download from Google Play

Format as decimal - Please help me!

Discussion in 'App Inventor' started by mannaggia, Mar 29, 2013.

  1. mannaggia

    mannaggia New Member
    Thread Starter

    Mar 29, 2013
    Hello everybody!
    First of all, I'd like to thank the editors of this valuable blog and I'd like to apologize for my poor English.
    I'm developing an app (using app inventor) for which I need to round to two decimal places the input entered by the user with "n" decimal places. To do this, I used "format as decimal". I noticed, however, a behavior I did not expect; for example, by entering 38.035, "format as decimal" returns 38.03. Likewise, 38.135 is rounded to 38.13, 38.235 -> 38.23. But with 38.335 rounding is, as expected, 38.34. Other examples: 0.015 -> 0.01, 0.215 -> 0.21, but 0.315 -> 0.32, as expected.
    I've read somewhere that App Inventor follows the rounding convention known as "half-to-even", but the tests I've done (like the ones I listed here) do not support this hypothesis. So I'd like to ask: what's wrong? Is there anyone who gets the same results?
    Thank you ...


  2. royalecraig

    royalecraig Member

    Feb 22, 2017
    Strange, is it fixed yet in AI2 how about checking your decimal places setting too.

Share This Page