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 ...
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 ...