Post Reply 
HP-42S (Free42, DM-42) mini-challenge – Wallis Product
07-04-2020, 04:42 PM (This post was last modified: 07-04-2020 04:43 PM by Gerson W. Barbosa.)
Post: #1
HP-42S (Free42, DM-42) mini-challenge – Wallis Product
\(\pi \approx 2\left ( \frac{4}{3} \times \frac{16}{15}\times \frac{36}{35}\times\frac{64}{63} \times \cdots \times \frac{ 4n ^{2}}{ 4n ^{2}-1}\right )\)

Write a program to evaluate the Wallis product on your HP-42S or DM-42.

Restrictions:

1. Stack-only (X, Y, Z, T & L);
2. Keep at least one copy of the previous content of the X register on the stack (no need to leave it on Y);
3. No limitation for the value of n.

Least number of steps then least number of bytes, including a 2-character label, wins.

Examples:

1 XEQ “WP” -> 2.66666666667
10 -> 3.06770380664
123 -> 3.13523960409
1E6 -> 3.141591868192120714596476681464745 (Free42 only)

Occasional diferences in the last two significant digits will be irrelevant.

Have fun!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-42S (Free42, DM-42) mini-challenge – Wallis Product - Gerson W. Barbosa - 07-04-2020 04:42 PM



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