3 Replies Latest reply on Nov 22, 2013 5:50 AM by kevin_intel

    CPU radian-based calculation

    masudyo

      I have tried on Microsoft Excel, OpenOffice.org, LibreOffice and some else to

      calculate radian-based calc., sin(x)+sin(x+120)+sin(x+240) which must be

      always zero with any number x. Upon Windows (XP 32bit, 7 64bit), Intel CPU

      and AMD CPU, Linux, FreeBSD, all gave some "non-zero" values on later angle

      (180-360) and increase "non-zero" value (gives plus and minus side) till 1440

      angle degree. Angle 0, 360, 720, 360xn would always give expected zero value,

      but failed to give.

       

      Whether CPU converts radian, "non-zero" error values should stay without

      increasing, but obtained results did not show steady error value. Tested are

      Core5, Pentium4, Athlon, and there are no to few difference on systems and

      no difference on softwares including the operating systems.

       

      If I could to know whether RISC gives similar pattern, could somebody tell

      me the results?

        • 1. Re: CPU radian-based calculation
          kevin_intel

          Hi masudyo,

          Let me find some more information and I will be back soon with updates.

          1 of 1 people found this helpful
          • 2. Re: CPU radian-based calculation
            masudyo

            example of error was printed as follows,

             

            =sin(radians(X))+sin(radians(X+120))+sin(radians(X+240))

            calculated with cell A2- (repeated autofill) as X value on OpenOffice 4.01/Windows 7Pro 64bit

             

            0-3600 degree (0.1 increment), 3600-5800 (1 increment) 5800-6400 (2 increment) 6400-7000 (5 increment)

            error occurs mainly at around 150, 300, 450, 600, 750, 900 ...

            1800-3600, 3600-above shows similar patterns, although above 3600 degree shows wider error ranges.

             

            radian-calc.png

            thus error occurs -1800 angle degree on certain value ranges (though fifth and sixth peaks are wider than else). Wider error starts from 1800 angle degree to 3600 and appearance of error came spread.

            Same pattern could be obtained with AMD chipset (athlon tested), and Excel. I have no RISC-based unix nor 68-based Apple-PC, I could not test the situation differences.

             

            As Kevin wrote below, I have re-calculated 0-1440 degrees (1 increment) in OpenOffice.org (Win7 64 bit), with original sin(radians()) way.

            dot blue : sin(radians(x))+sin(radians(x+120))+sin(radians(x+240))

            dot orange : sin(x*PI()/180)+sin((x+120)*PI()/180)+sin((x+240)*PI()/180)

            where x is A2 to A1442 (value 0 to 1440)

            the result:

             

            orange is worse than blue, thus radian exchange is not equal in radians formula to PI()/180 on CPU loading because the results are different (attached sin_recalc.png).

             

            Thus Kevin, "trusted ways of calculation of ordinal high-voltage line short-circuit" failed to proof zero-value in the range of plus to minus 180 degree range what-so-ever on the x86-based systems (P4=32bit, U3400=64bit, athlon=32bit). I have no chance to know whether RISC (IRIX, Solaris etc) or 68-based old Mac. It truely failed to give. As one of chemists, I wonder if this error value (although it would be 0.1ppb order) affects like ancient floating point defect (that gave ocasionally ppm-order error though). And as a chemist, I know sin() function handles radians not degrees (thus converting radians to degree by using radians() function inside.

             

             

            first error value could be obtained in 1 increments from 0 is 112, sin(radians(112))+sin(radians(232))+sin(radians(352))=-5.82867087928207E-016

            Kevin's PI() method gave first error at 110 (error value was -7.49400541621981E-016), but at 112 the error was -5.82867087928207E-016 (same as above). Followed was 116, 117, 119, 120, 121, 122, 125, 126, till 180 angle degree (Kevin's way gave additional 113, 118, 128, 132 angle degrees, but all radians() error angles gave error values with sometimes different value (closely twice, but not exactly twice).

             

            sin(radians(A2*sin(A2))) like floating values also give some error values similar to those in 0.1 increments.

             

             

            # if you missed to give radians() function or PI()/180, you would obtain at x=0 sin(0)+sin(120)+sin(240)=1.5260563391. It is not an error level from zero :-)

            • 3. Re: CPU radian-based calculation
              kevin_intel

              Hi masudyo,

              The Excel Sin() function expects the input to be in Radians, but you appear to be using Degrees. You must therefore convert your Degrees to Radians by multiplying by Pi/180.

               

              Assuming your ‘x’ value is in cell e2, using the formula:

              =SIN(E2*PI()/180)+SIN((E2+120)*PI()/180)+SIN((E2+240)*PI()/180) works.  It always evaluates to 0 no matter what value you put in cell e2.

              1 of 1 people found this helpful