dec2 (s1: string): string; co, i, j, k, n, g, cod: integer; sum, h, e, ns : extended; sr, pos1: string; posd: longint;: = 0; e: = 1; i: = 1 to length (s1) do begin: = s1 [i]; sr = '1 'then begin: = 1 ; k: = 1 to length (s1)-i do ns: = ns * 2; {tut zero!}: = sum + (ns); end;; (sum: 0:0, pos1);: = pos1 ;; dvvdecdrob (s1: string): string; co, i, j, k, n, g, cod: integer; sum, h, e, ns: extended; sr, pos2: string; posd: longint;: = 0 ; e: = 1; i: = 1 to length (s1) do begin: = s1 [i]; sr = '1 'then begin: = 1; k: = 1 to i do ns: = ns * 2; { tut zero then begin {pri nulE} z1 = '11 'thenz2 [1] = '1' do begin (z2, 1,1); norsdv: = norsdv +1; norzac: = true;; z1 = '00 'thenz2 [1 ] = '0 'do begin (z2, 1,1); norsdv: = norsdv +1; norzac: = true;; end; end; posl; ch: char; i, k, l: integer; ; Z1 = '11 'then mtrue: = true;: = obrcod (z2, mtrue); (' mantisa (Z (pr.)) = ', z1,'. ', Z2); normaliz; norzac then begin (' Зрушення на ', norsdv,' вліво ', z1,'. ', z2,
'P (z) =', por, '-', norsdv, '=', por-norsdv) end; z1 = '11 'then zn: =' - '; (' Z = ', zn, '0.', z2, '* 2 ^', por-norsdv);: = por-norsdv;: = por-norsdv;: = 1; por> 0 then beginpor <> 0 do begin : = pos1 + z2 [l]; por: = por-1; l: = l +1; end; i: = l to length (z2) do pos2: = pos2 + z2 [i]; endbegin: = '0 ';: = z2; por <> 0 do begin: = '0' + pos2; por: = por +1; end; (pos2, 63, length (pos2));
{for i: = l to length (z2) do pos2: = pos2 + z2 [i];}; (length (pos1) + length (pos2)) = por3 then writeln ('Z = ', zn, pos1) else (' Z = ', zn, pos1,'. ', pos2); i: = izdvvdec2 (pos1); i: = dvvdecdrob (pos2); (' Z = ', zn, pos1i , '.', pos2i);
{str (pos2i, pos2is);} i: = pos1i + '.' + pos2i; (pos1i, nast1, n);: = abs (nast-nast1); ('Абсолютна похибка:' , abspog); {TUT OSHIBKA} ('Відносна похибка:', abs (abspog/nast1) {nast1: 0:5}); zn <> '-' then ('Істинне значення:', nast) writeln (' Істинне значення: - ', nast);; rastoch;: = nast1 * nast2;: = length (ch1s1dv); pory: = length (ch2s1dv);: = porx-1; pory2: = pory-1;: = Dec2Bin ( porx); then writeln ('A (у 2-ий СС):', zs1, ch1s1dv, '.', ch1s2dv) writeln ('A (у 2-ий СС):', zs1, ch1s1dv); ch2s2dv <>'' then writeln ('B (в 2-ий СС):', zs2, ch2s1dv, '.', ch2s2dv) writeln ('B (в 2-ий СС):', zs2, ch2s1dv); (''); zs1 = '-' then chpminx: = true; zs2 = '-' then chpminy: = true;: = ch1s1dv + ch1s2dv;: = ch2s1dv + ch2s2dv; chpminx = true then ma1: = '11 'else ma1: = '00' ; chpminy = true then mb1: = '11 'else mb1: = '00'; (ma2, mb2); modula: = ma2;
writeln ('A в розширеній точності'...