Programming example: cosine

This is a program that calculates the cosine of a number. This is program n.8 from the Olivetti program library:

This program is coded on a standard programming sheet of the P101. The instructions are written in the columns, to the right are small boxes to describe the registers used by the program.

The lower part of the sheet is used to say what constants have to be stored in registers and recorded on the magnetic card. One would type in the program, then manually store the constants in the registers and then record the card. The program, when loaded, will find the constants already in the right registers.

In this case, the constants are coefficients for the cosine polynomial, while D holds either 3.1415, 180 or 200: the same program, changing the number stored in D, is able to work in radiants, in degrees and in 400-based degrees.

This page is part of the Programma 101 Web