File: pi2.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-- 204 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
// pi2.hpc -- Calculate the pi (Algorithm 2) -*- C -*-

// k is the number of iterations
declare pi2(k) : s(0), x(0) {
	for (x = -k; x <= k; x += .5)
		s += EXP(-(x**2)) * .5;
	s ** 2;		// Return value
}