Where'd TSO-REXX go? No action in about a month. After a thread in the z390 forum:
/* Rexx */ signal on novalue; /* # Nilakantha approximation to π. After: https://helloacm.com/two-simple-equations-to-compute-pi/ See: https://en.wikipedia.org/wiki/Alternating_series#Alternating_series_test */ parse value arg( 1 ) 5 with ndig . /* Digits precision. */ numeric digits ndig * 2 /* Be generous with guard digits. */ EPSILON = 3 / 10 ** ndig ans = 3 do j = 2 by 2 until term <= EPSILON term = 4.0 / (j * (j + 1) * (j + 2)) ans = ans + ( j // 4 - 1 ) * term say right( j % 2, 10 ) format( ans, 2, ndig + 2 ) format( term, 2, 6, 3, 0 ) end j -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
