Yes, 355÷113 is very close to π, but is not equal to π

So how does it get things ‘right’ for cos(355÷113), but not right for sin(355÷113)?

And why is the error of π-355÷113 exactly the same as the error of sin(355÷113)?

I sense some fuckiness of how they handle π…

  • zkfcfbzr
    link
    English
    122 days ago

    There isn’t really an issue here. The reason the cosine value is rounded to -1 while the sine value isn’t rounded to 0 is because the cosine value is much closer to -1 than the sine value is to 0. The unrounded (or less rounded) values are cos(355/113) = -0.99999999999996441843 and sin(355/113) = -0.00000026676418906242. So while the sine value is about 10^-7 from 0, the cosine value is about 10^-13 from -1, 6 orders of magnitude closer. Your calculator’s threshold for rounding is just somewhere between those magnitudes.

    As for why the latter two calculations give identical answers, that’s just a feature of sine itself: For very small inputs it’s an excellent approximation of the identity function, f(x) = x. If you give it any input of similar size to π - 355/113, it’ll more likely than not give you the exact same value back out. As x → 0, sin(x) → x. Try it out with other values like 0.0000000123456789.

    • @over_cloxOP
      link
      2
      edit-2
      2 days ago

      Interesting. My TI-36X Solar version 3 from 1994 seems to get gets these calculations exactly right, within the 10 digit display, plus 2 hidden digits for extra accuracy.

      Yes, my calculator from 1994 is seemed more accurate than this crap manufactured in 2009. Advertised to be of the same 10+2 digits of accuracy no less.

      Edit: Sigh, reminders of over 25 years ago when I compared engineering rulers together and none of them perfectly matched up.

      • zkfcfbzr
        link
        English
        82 days ago

        To be clear, when you say “exactly right”, do you mean -1 and 0 or -1 and -2.6776418E-07? Because -2.6776418E-07 is the more accurate answer here. 10+2 digits of accuracy does round the cosine to -1 because its first 13 digits after the decimal are all 9s, while 10+2 decimals of accuracy for the sine should be -0.000000266764 (12 digits) rounded to -0.0000002668 (10 digits rounded), then displayed as -2.668E-07 - so you actually end up with some bonus accuracy in this case. Though that last 8 should round up to a 9.

        • @over_cloxOP
          link
          12 days ago

          Note, I edited my comment. Now I’m reminded of when I tested engineering grade rulers against each other like 25 years ago and nothing perfectly matched… ☹️

        • @over_cloxOP
          link
          0
          edit-2
          2 days ago

          I found the results of cos(355/113) to be odd, as I’d expect it to give me a value of 0.99849715, not 1.

          Which begs a different question, since when does cos(π) = -1?

          My Linux Mint 20 system wouldn’t crank out a 1 until I simplified the calculator down to cos(22/7), and that was a positive one, not negative. Which matches the sign of my TI-36X, positive one.

          Now we’re getting down to some real brass tacks here, what’s the chirality of trig functions, is cos(π) supposed to equal positive or negative one?

          Edit: within whatever margin of error, QBasic gives me -1, Casio Calculator gives me -1, Linux Calculator gives me +1, and Texas Instruments gives me +1…

          WTF?

          • zkfcfbzr
            link
            English
            52 days ago

            That comes down to the calculator using radians while you’re expecting degrees: cos(0°) = 1, and cos(355/113 degrees) = 0.99849714986386383364. The default for most calculators is to do trig functions in radians, and there we have cos(0) = 1 and cos(π) = -1. π degrees is much closer to 0° than 180° (which is equivalent to π radians), hence the answer for that being almost 1.

            The OPTN button near the SHIFT button will probably let you swap between RADians and DEGrees

            • @over_cloxOP
              link
              12 days ago

              Oh hell, alrighty then! Sure enough my old QBasic 3D graphics engine from 1998 was working in radians!

              Holy hell I forgot about that, it’s been about 27 years since I actually looked at my first rendering engine!

              I’ll see myself out now, but thank you for the refresher! 👍

            • @over_cloxOP
              link
              0
              edit-2
              2 days ago

              I almost guarantee you all my calculators are configured for degrees for these tests. I edited my comment after testing 4 different calculators.

              Now I just don’t know why two of them give me -1 and the other two give me +1.

              Edit: I may have to learn more about this Casio, but still I’m getting conflicting results between other calculators, including modern Linux Calculator.

              • zkfcfbzr
                link
                English
                22 days ago

                The correct answer in degrees is cos(pi) = 0.99849714986386383364. The correct answer in radians is cos(pi) = -1 (exactly). Any calculator giving you cos(pi) = -1 is definitely in radians mode - and if you mean you’re getting cos(pi) = exactly 1, and not 0.998, then that should never happen in any mode, unless it just has two digits of accuracy. Which I doubt any calculator with a ‘cos’ button has ever had.

                For the record, if using sine, you should have sin(pi) = 0.05480366514878953089 if in degrees mode, or sin(pi) = 0 (exactly) if in radians mode.