5 kyu

No Return #3: Solve the Equation

Description
Loading description...
Mathematics
Algorithms
  • Please sign in or sign up to leave a comment.
  • ilyushal33t Avatar

    i got errors like:

    Expected 982.2689999999999, got -982.2689999999999 (- x +740.202- 121.427 +437.24 -88.982 - 698.946+714.182=0)

    this is disappoint me because if u calculate it will be:

    - 982.2689999999999 +740.202- 121.427 +437.24 -88.982 - 698.946+714.182 = 1.1368683772161603e-13

    but if u (u know) fix it to 982.269 its will be the right answear so why do not just return 982.269 instead of 982.2689999999999 ?

    • Chrono79 Avatar

      Not a kata suggestion, it's a question. And if x is -982.2689999999999 then the equation becomes this:

      (- (-982.2689999999999) +740.202- 121.427 +437.24 -88.982 - 698.946+714.182=0)
      (982.2689999999999 +740.202- 121.427 +437.24 -88.982 - 698.946+714.182=0)
      

      The problem is in the sign, you're returning it wrong.

      Suggestion marked resolved by Chrono79 3 years ago
  • MP7373 Avatar

    I finally got it but it's the most disgusting ternary i've ever written lol. This one was tough for me.

  • docgunthrop Avatar

    At first I thought "why?", but then I figured "why not?" 🙃

  • hufftheweevil Avatar

    This comment has been hidden.

  • Voile Avatar

    Why are the tests running the solution twice for each test?

  • JohanWiltink Avatar

    OK, you've made your point. Can we now go back to using return when it's more natural to do so?