Ad
  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    C#: method name should be PascalCase (Please refer to implementation of backward compatibility here )

  • Default User Avatar

    Sample tests should include case where numbers are diffent, but they're both either odd or even.
    For instance Ruby:
    Test.assert_equals(lovefunc(7,5), false)
    or
    Test.assert_equals(lovefunc(6,8), false)

    Sample tests are passable with simple "value1 != value2", although they obviously fails the attempt and they would also fail if any of two examples above would be added.

  • Custom User Avatar

    Multiplying numbers and rounding to decimal places has already been done to death.

  • Default User Avatar

    Needs random test cases

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This kata doesn't use any random tests yet. If it would use random tests and/or numbers up to 1e+50 you would notice that some solutions don't work due to the different order of fractional operations:

    Test.assertEquals(car(1e+50,1), 8e+49.toFixed(2))
    

    Instead of a string based test, a relative error comparison would be more adequate, e.g.

    function assertFuzzyEquals(actual, expected, msg){
      var rel_err = Math.abs((actual - expected)/expected);
      Test.expect(rel_err <= 1e-12, 
        "the actual value " + actual + 
        " differed from the expected one " + expected + 
        " by more than 0.0000000001%" +
        (msg ? "; " + msg : "")
      );
    }
    

    That way people can concentrate on the mathematics and don't need to worry about the order of their multiplication.

    PS: @Giacomo, @Zozo: Does any of you remember where I've used assertFuzzyEquals before? I can't find the kata.