Ad
  • Custom User Avatar

    Testing expects numerical NaNs and Infinitys, but does not check if normal digits are Strings or Numbers. It's not specified either.

    It should be specified ( preferably as Numbers, though the Strings '-' and '.' grate ), and it should be tested.

  • Custom User Avatar

    Because the reference solution isn't even arbitrary precision real arithmetic, the answer derived by the reference solution is simply wrong. e.g:

    1000000000000000 / 3896526038118073 =   
    Expected:    '0.25663885990172302343866078834952392091192966443253258931043169884814443475859689408669779071203048'
    instead got: '0.25663885990172302292589578160906176584827770888387331907749834099698695209475275668754975679175249'
    

    The correct result is 0.25663885990172302292589578160906176584827770888387331907749834099698695209475275668754975679175249426790238934990... as shown by Wolfram Alpha:

    http://www.wolframalpha.com/input/?i=1000000000000000+%2F+3896526038118073

    Edit: as another demonstration of the incorrect behaviour, I tested some inputs where a === b, and the reference solution aren't even giving 1.0000...:

    4413009194955343.5 / 4413009194955343.5 = 
    Expected: '1.00000000000000018128219649179667453475071807778479860673338614478811930419432495701952533845572735'
    instead got: '1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
    
    2543978772493869.5 / 2543978772493869.5 = 
    Expected: '9.99999999999999818307358842815939036168824334963639236381663286780869761669083041842512192848775626'
    instead got: '1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
    
  • Custom User Avatar

    Needs tests with large initial dividend and a small divisor. Very large (or small) quotients aren't tested at all.

  • Custom User Avatar

    Since this is a kata about big decimal, the typical stuff should be banned, aka all the ways that can cause require('bignumber.js') to work.

  • Custom User Avatar

    Also there is no point in identifying -0. It's considered practically the same to everything except to Object.is, and even (-0).toString() gives 0. It's analogous to saying that all NaNs are equal, which is absurd, an artifact of IEEE floats standard and not a good practice in any means.

  • Custom User Avatar

    There is no point in getting digits below precision of a double, because they aren't even resolvable. Even a change in the tiniest significant bit in the divisor will cause the result to change significantly after the 16th digit (aka 1/Number.MAX_SAFE_INTEGER).

    I don't think you really understand the intracacies of arbitrary precision real arithmetic. They simply aren't done this way. To begin with, passing numbers in as floating point values is already a grave mistake. They should be passed in as strings (but then this kata would be a duplicate to https://www.codewars.com/kata/divide-numbers-as-strings).

  • Custom User Avatar

    Random tests section titles has a typo: Things like -2345658712136251.5 = 7811398559714191 = should be -2345658712136251.5 / 7811398559714191 =.