File: pi1.hpc

package info (click to toggle)
hp48cc 1.3-7
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 380 kB
  • sloc: yacc: 452; ansic: 184; lex: 108; makefile: 90; sh: 90
file content (8 lines) | stat: -rw-r--r-- 188 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
// pi1.hpc -- Calculate the pi (Algorithm 1) -*- C -*-

// k is the number of iterations
declare pi1(k): s(0) {
	for (; k >= 0; --k)
		s += (-1)**k/(2 * k + 1);
	s * 4;		// Return value
}