While browsing a disk image from the Soviet mainframe BESM-6, I've found some bits and pieces of a computational math library for Algol-60, stored in plaintext (if the Soviet GOST 10859 encoding with parity, as if on punched cards, can be considered plaintext).
One function is of particular interest because of an error message expressed in a jocular/familiar style. The function name means LAGRANGE2, and a few single-letter Cyrillic variable names should not be too confusing.
I've added spaces, indented and reflowed the text for readability:
_REAL _PRОCEDURE ЛАГРАНЖ2(A,Х,У,Х1,Х2,P,П,П1);
_REAL Х1, Х2; _INTEGER P, П, П1; _ARRAУ A, Х, У;
_BEGIN
_REAL S, Z, Z1;
_INTEGER I, J, J1, К;
_ARRAУ S1[0:20];
_INTEGER Я, Я1;
_IF Х2 < A[1] _THEN _BEGIN
Z := Х2;
_GО _TО М3;
_END ;
_IF Х1 < Х[1] _THEN _BEGIN
Z := Х1;
_GО _TО М3;
_END ;
S := 0;
_FOR J1 := 1 _STEP 1 _UNTIL П1 _DО
_IF Х2 ≥ A[J1] ∧ Х2 ≤ A[J1+1] _THEN
_GО _TО М1;
Z := Х2;
_GО _TО М2;
М1: _FOR I := 1 _STEP 1 _UNTIL П _DО
_IF Х1 ≥ Х[I] ∧ Х1 ≤ Х[I+1] _THEN
_GО _TО М;
Z := Х1;
_IF Х1 ≤ Х[П] _THEN
_GО _TО М;
М2: _IF Х2 ≤ A[П1] _THEN
_GО _TО М;
М3: ОUTPUT(‘T’,‘ПРИ ОБРАЩЕНИИ К ПРОЦЕДУРЕ ЛАГРАНЖ2 АРГУМЕНТ=’,
‘E’,Z,‘T’,
‘ВЫШЕЛ ЗА ПРЕДЕЛЫ ТАБЛИЦЫ. РАЗБЕРИСЬ В ЧЕМ ДЕЛО, А Я ПРЕРЫВАЮ СЧЕТ. ДО ВСТРЕЧИ!’);
ОUTPUT(‘×’);
S := S / 0;
М: _IF I ≤ П - P _THEN
J := I
_ELSE
J := П - P;
_IF J1 > П1 - P _THEN
J1 := П1 - P;
Я1 := J1;
_FOR Я := 0 _STEP 1 _UNTIL P _DО _BEGIN
S := 0;
_FOR I := 0 _STEP 1 _UNTIL P _DО _BEGIN
Z := Z1 := 1;
_FOR К := 0 _STEP 1 _UNTIL P _DО _BEGIN
_IF К ≠ I _THEN
Z := Z × (Х1 - Х[К+J]) / (Х[I+J] - Х[К+J]);
_END ;
S := S + У[I + J + (J1 - 1) × П] × Z;
_END ;
S1[Я] := S;
J1 := J1 + 1;
_END ;
S := 0;
_FOR I := 0 _STEP 1 _UNTIL P _DО _BEGIN
Z := Z1 := 1;
_FOR К := 0 _STEP 1 _UNTIL P _DО _BEGIN
_IF К ≠ I _THEN
Z := Z × (Х2 - A[К + Я1]) / (A[I + Я1] - A[К + Я1]);
_END ;
S := S + S1[I] × Z;
_END ;
ЛАГРАНЖ2 := S;
_END
The error message means "When calling the LAGRANGE2 procedure, the argument value was outside the table. Find out what is the issue, and I am interrupting the calculation. SEE YOU!". After printing the message, a divide-by-zero error is forced.
What was that function calculating? A guess would be Lagrange interpolation, but computing all the coefficients only to produce a single result would be wasteful. Moreover, there are 3 input arrays instead of the expected two.