% Angewandte Numerik 1, SoSe 2014 % Uebungsblatt 01, Aufgabe 3: Gleitpunktdarstellung % % Testprogramm fuer Funktion x = value(b, d, v, t) clear all; close all; clc; tol = 1e-14; %% Testfall 1 b = 2; d = [1 0 1 0 0 1 0 0]; v = [0 0 1 0 0]; t = 1; x = value(b,d,v,t); if (abs(x-10.25) < tol) fprintf('Testfall 1: Bestanden.\n') else fprintf(2,'Testfall 1: Fehlgeschlagen.\n') end %% Testfall 2 b = 2; d = [1 0 1]; v = [0 0 1]; t = -1; x = value(b,d,v,t); if (abs(x-0.3125) < tol) fprintf('Testfall 2: Bestanden.\n') else fprintf(2,'Testfall 2: Fehlgeschlagen.\n') end %% Testfall 3 b = 8; d = [7 5 0]; v = [0 0 1]; t = -1; x = value(b,d,v,t); if (abs(x-0.119140625) < tol) fprintf('Testfall 3: Bestanden.\n') else fprintf(2,'Testfall 3: Fehlgeschlagen.\n') end