Ad
  • Custom User Avatar

    Two ways to calculate avg. expense: 1. sum up all the expenses then take average; 2. take average over differce of balances from start to the end.

    It seems only the second way works, but why the first one not? due to precision issue?? With R, it matters when rounding. Should this be mentioned somewhere in the description?

  • Custom User Avatar

    I had the same problem like yours...no clue

  • Custom User Avatar

    What is the rule for rounding here? I tried many rounding methods. I have no idea why 45.525 is expected to 45.53, while 45.105 is expected to 45.10???

    I used %.2f with sprintf in R. I am going mad with the rule ........

  • Custom User Avatar
  • Custom User Avatar

    Then forget about my question. Thank you all the same :). Mine is just a suggestion to make things harder, since that might be related to the parse/deparse of expression in the input.

  • Custom User Avatar

    I mean, 0.67 as input might be either a result rounded from others with large decimals or just 0.67 itself. When it is written as "0.67", then it can only interpreted as 0.67, as parsed input for different languages.

    I see there is a package that can take care of making a decimal into the fractional manner. For practice purpose, I guess it might be better not to use additional packages to pass the task (making task more complex a bit :P)

  • Custom User Avatar

    Thanks for fast reply!

    One more thing, I guess there might be a concern of precision of decimal as input for different languages, and hence a string input (e.g., "3/4" or "0.67", instead of 3/4 or 0.67) can refer to exact the one as unique. How do you think? :)

  • Custom User Avatar

    Which format of output should be with R language? It seems, for example, the string "1/2,1/4" as output does not work.
    Also, it is mentioned the input is a string, but the test example gives it as numeric, which is confusing