blob: 4f27c83654d6a08c5c8c440d1a46ae3d0acfe2e0 [file] [log] [blame]
// Copyright 2019 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
display=hexadecimal !;
print("log2(e) =", round(log2(exp(1)), single, RN));
minus_ln2_hi = round(-log(2), single, RN);
minus_ln2_lo = round(-log(2) - minus_ln2_hi, single, RN);
print("-log(2):hi =", minus_ln2_hi);
print("-log(2):lo =", minus_ln2_lo);
print("log2(e) * 8 =", round(log2(exp(1)) * 8, single, RN));
minus_ln2_o8_hi = round(-log(2)/8, single, RN);
minus_ln2_o8_lo = round(-log(2)/8 - minus_ln2_o8_hi, single, RN);
print("-log(2):hi / 8 =", minus_ln2_o8_hi);
print("-log(2):lo / 8 =", minus_ln2_o8_lo);
lb = round(-log(2)/2, single, RN);
ub = round(log(2)/2, single, RN);
print("-log(2)/2 = ", lb);
print("+log(2)/2 =", ub);
P = fpminimax(exp(x), [|1,2,3,4,5|], [|SG...|], [lb; ub], relative, 1);
print("Degree-5 P[exp(x)] with 1 constraint on [-log(2)/2, log(2)/2] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/2, single, RN);
ub = round(log(2)/2, single, RN);
print("-log(2)/2 = ", lb);
print("+log(2)/2 =", ub);
P = fpminimax(exp(x), [|2,3,4,5|], [|SG...|], [lb; ub], relative, 1+x);
print("Degree-5 P[exp(x)] with 1+x constraint on [-log(2)/2, log(2)/2] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/8, single, RN);
ub = round(log(2)/8, single, RN);
print("-log(2)/8 =", lb);
print("+log(2)/8 =", ub);
P = fpminimax(exp(x), [|2,3,4|], [|SG...|], [lb; ub], relative, 1+x);
print("Degree-4 P[exp(x)] with 1+x constraint on [-log(2)/8, log(2)/8] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/16, single, RN);
ub = round(log(2)/16, single, RN);
print("-log(2)/16 =", lb);
print("+log(2)/16 =", ub);
P = fpminimax(exp(x), [|1,2,3,4|], [|SG...|], [lb; ub], relative, 1);
print("Degree-4 P[exp(x)] with 1 constraint on [-log(2)/16, log(2)/16] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/16, single, RN);
ub = round(log(2)/16, single, RN);
print("-log(2)/16 =", lb);
print("+log(2)/16 =", ub);
P = fpminimax(exp(x), [|2,3,4|], [|SG...|], [lb; ub], relative, 1+x);
print("Degree-4 P[exp(x)] with 1+x constraint on [-log(2)/16, log(2)/16] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/16, single, RN);
ub = round(log(2)/16, single, RN);
print("-log(2)/16 =", lb);
print("+log(2)/16 =", ub);
P = fpminimax(exp(x), [|1,2,3|], [|SG...|], [lb; ub], relative, 1);
print("Degree-3 P[exp(x)] with 1 constraint on [-log(2)/16, log(2)/16] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/16, single, RN);
ub = round(log(2)/16, single, RN);
print("-log(2)/16 =", lb);
print("+log(2)/16 =", ub);
P = fpminimax(exp(x), [|2,3|], [|SG...|], [lb; ub], relative, 1+x);
print("Degree-3 P[exp(x)] with 1+x constraint on [-log(2)/16, log(2)/16] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/32, single, RN);
ub = round(log(2)/32, single, RN);
print("-log(2)/32 =", lb);
print("+log(2)/32 =", ub);
P = fpminimax(exp(x), [|2,3|], [|SG...|], [lb; ub], relative, 1+x);
print("Degree-3 P[exp(x)] with 1+x constraint on [-log(2)/32, log(2)/32] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/64, single, RN);
ub = round(log(2)/64, single, RN);
print("-log(2)/64 =", lb);
print("+log(2)/64 =", ub);
P = fpminimax(exp(x), [|1,2|], [|SG...|], [lb; ub], relative, 1);
print("Degree-2 P[exp(x)] with 1+x constraint on [-log(2)/64, log(2)/64] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/128, single, RN);
ub = round(log(2)/128, single, RN);
print("-log(2)/128 =", lb);
print("+log(2)/128 =", ub);
P = fpminimax(exp(x), [|1,2|], [|SG...|], [lb; ub], relative, 1);
print("Degree-2 P[exp(x)] with 1 constraint on [-log(2)/128, log(2)/128] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/128, single, RN);
ub = round(log(2)/128, single, RN);
print("-log(2)/128 =", lb);
print("+log(2)/128 =", ub);
P = fpminimax(exp(x), [|2|], [|SG...|], [lb; ub], relative, 1+x);
print("Degree-2 P[exp(x)] with 1+x constraint on [-log(2)/128, log(2)/128] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));
lb = round(-log(2)/2048, single, RN);
ub = round(log(2)/2048, single, RN);
print("-log(2)/2048 =", lb);
print("+log(2)/2048 =", ub);
P = fpminimax(exp(x), [|0,1|], [|SG...|], [lb; ub], relative);
print("Degree-1 P[exp(x)] with 1 constraint on [-log(2)/2048, log(2)/2048] =", horner(P));
print("relative error =", round(dirtyinfnorm(P / exp(x) - 1, [lb; ub]), single, RU));