You are here

Shift Registers

26 July, 2019 - 09:47
Available under Creative Commons-ShareAlike 4.0 International License. Download for free at

Programmatically, while loop shift registers are identical to for loop shift registers. Refer to Section Shift Registers for the discussion. However, an example is provided to illustrate the use of shift registers in while loops.

Figure 5.38 While Loop Shift Registers 

In the following example, Euler's number e is computed to the specified accuracy using the infinite series


Notice that two shift registers keep track of the factorial and the sum. Also notice the dot in the multiplication. This is because the loop iteration is an integer 32 data type and the input from one of the shift registers is double precision numeric. The dot represents that the integer 32 data type has been coerced into a double precision number.

Figure 5.39 Computing e  

Save the program as The result of running this program is shown in Computed e to 5 Digits.

Figure 5.40 Computed e to 5 Digits