Post Reply 
Can you calculate Pi using a Solver?
12-09-2019, 03:53 PM
Post: #6
RE: Can you calculate Pi using a Solver?
Code:
120   LET T=    3 . 1 4 1 5 9 2 7      *(D/180)

WHAT?

Code:
120   LET T=3.1415927*(D/180)
130   LET A=2*N*SIN(T/2)
140   LET B=2*N*TAN(T/2)

155   IF A=B THEN GOTO 170

170 END

Err... this looks like a checking how precise the arithmetics of that computer...

BTW: HP32SII - a fraction finder

Code:
---------------------
LBL Q
  RCL P
  RCL / Q
  RCL - K
  STO D        //D=P/Q-K
  ABS
  RCL E
  X>=Y?        //E>=ABS(D)?
RTN            //Yes, end of the program
  RCL D        
  X<0?         //P/Q<K ?
  GTO P        //Yes, increase P
  1            // No, increase Q
  STO + Q
  GTO Q        
---------------------
LBL P          // Increase P
  1
  STO + P
  GTO Q
---------------------

Checksums:
==========
LBL Q: CK=9676 / 22.5 byte
LBL P: CK=C1C6 / 6.0 byte

Variables:
==========
P, Q, K, E, D

Timing:
=======
| Number (K) | Error (E) | P    | Q   | Number of steps (P-1+Q-1) | Running time | Steps/secs |
| PI         | 1E-5      |  355 | 113 |  466                      |   41.5s      | 11.2/s     |
| SQRT(2)    | 1E-5      |  577 | 408 |  983                      |   86.1s      | 11.4/s     |
| e          | 1E-5      | 1071 | 394 | 1463                      |  129.7s      | 11.3/s     |

Csaba
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Can you calculate Pi using a Solver? - Csaba Tizedes - 12-09-2019 03:53 PM



User(s) browsing this thread: 1 Guest(s)