Triangle Area rounding problem

Back to Problem Solutions forum

transingularity     2015-07-01 18:07:57

Hi again everybody,

I almost solve this task and it shows right answers, but in some numbers it doesn't have to be rounded, instead of it it just have silly .5 in the end. Like this:

1145539.5 14625492 5751416.5 19016125 870187.5 6065277 9032876.5 4295329.5 251325 8209899.5 4631767.5 56242 8525726 3165990 3381414 7701172

My output:

1145540 14625492 5751416 19016125 870187 6065277 9032877 4295329 251325 8209899 4631767 56242 8525726 3165990 3381414 7701172

Why does it needed? Why these numbers can't be rounded normally like other normal numbers?

Thank you :)

transingularity     2015-07-01 18:19:42

Well. I solved it. I just didn't round anything and get output like this:

655743.9999999953 5960008.499999994 4561835.00000001 9612478.0 3646712.499999997 2418182.500000001 1044742.0000000009 6090501.000000001 1.068283950000001E7 1.2784762000000002E7 446761.99999999924 8624668.0 1.5283624000000006E7 1.3269975499999994E7 1.6828825999999996E7 5955029.999999998

And this is correct. Is it a joke?

Rodion (admin)     2015-07-08 11:00:53
User avatar

Hi! Sorry for the delayed response.

You see, triangle with integer coordinates may have its area either integer, or "half-integer" - i.e. ending with .5 - so it did not look necessary to round results when I created the task.

Values without rounding, like this 655743.9999999953 5960008.499999994 are good as long as they fall within usual precision limit - I believe it is 1e-7 - but for some reason this is missed from the problem statement.

So thank you - I think I should add a statement about this to the page.

Please login and solve 5 problems to be able to post at forum