
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- d2 d3) (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d2 - d3) + (d4 - d1))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d3) + (d4 - d1))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d3) + Float64(d4 - d1))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d3) + (d4 - d1)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d3), $MachinePrecision] + N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\end{array}
Initial program 89.4%
associate--l+89.4%
distribute-lft-out--90.6%
distribute-rgt-out--93.7%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d1))) (t_1 (* d1 (- d3))) (t_2 (* d1 (+ d2 d4))))
(if (<= d3 -1.9e+91)
t_1
(if (<= d3 -1.5e-12)
t_2
(if (<= d3 -3.35e-164)
t_0
(if (<= d3 1e-107)
t_2
(if (<= d3 4e+43) t_0 (if (<= d3 1.6e+179) t_2 t_1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d1);
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.9e+91) {
tmp = t_1;
} else if (d3 <= -1.5e-12) {
tmp = t_2;
} else if (d3 <= -3.35e-164) {
tmp = t_0;
} else if (d3 <= 1e-107) {
tmp = t_2;
} else if (d3 <= 4e+43) {
tmp = t_0;
} else if (d3 <= 1.6e+179) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d1 * (d4 - d1)
t_1 = d1 * -d3
t_2 = d1 * (d2 + d4)
if (d3 <= (-1.9d+91)) then
tmp = t_1
else if (d3 <= (-1.5d-12)) then
tmp = t_2
else if (d3 <= (-3.35d-164)) then
tmp = t_0
else if (d3 <= 1d-107) then
tmp = t_2
else if (d3 <= 4d+43) then
tmp = t_0
else if (d3 <= 1.6d+179) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d1);
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.9e+91) {
tmp = t_1;
} else if (d3 <= -1.5e-12) {
tmp = t_2;
} else if (d3 <= -3.35e-164) {
tmp = t_0;
} else if (d3 <= 1e-107) {
tmp = t_2;
} else if (d3 <= 4e+43) {
tmp = t_0;
} else if (d3 <= 1.6e+179) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d1) t_1 = d1 * -d3 t_2 = d1 * (d2 + d4) tmp = 0 if d3 <= -1.9e+91: tmp = t_1 elif d3 <= -1.5e-12: tmp = t_2 elif d3 <= -3.35e-164: tmp = t_0 elif d3 <= 1e-107: tmp = t_2 elif d3 <= 4e+43: tmp = t_0 elif d3 <= 1.6e+179: tmp = t_2 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d1)) t_1 = Float64(d1 * Float64(-d3)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -1.9e+91) tmp = t_1; elseif (d3 <= -1.5e-12) tmp = t_2; elseif (d3 <= -3.35e-164) tmp = t_0; elseif (d3 <= 1e-107) tmp = t_2; elseif (d3 <= 4e+43) tmp = t_0; elseif (d3 <= 1.6e+179) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d1); t_1 = d1 * -d3; t_2 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -1.9e+91) tmp = t_1; elseif (d3 <= -1.5e-12) tmp = t_2; elseif (d3 <= -3.35e-164) tmp = t_0; elseif (d3 <= 1e-107) tmp = t_2; elseif (d3 <= 4e+43) tmp = t_0; elseif (d3 <= 1.6e+179) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.9e+91], t$95$1, If[LessEqual[d3, -1.5e-12], t$95$2, If[LessEqual[d3, -3.35e-164], t$95$0, If[LessEqual[d3, 1e-107], t$95$2, If[LessEqual[d3, 4e+43], t$95$0, If[LessEqual[d3, 1.6e+179], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -1.9 \cdot 10^{+91}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -1.5 \cdot 10^{-12}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq -3.35 \cdot 10^{-164}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 10^{-107}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 4 \cdot 10^{+43}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 1.6 \cdot 10^{+179}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d3 < -1.8999999999999999e91 or 1.6000000000000001e179 < d3 Initial program 85.5%
associate--l+85.5%
distribute-lft-out--89.4%
distribute-rgt-out--92.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 83.1%
mul-1-neg83.1%
distribute-rgt-neg-out83.1%
Simplified83.1%
if -1.8999999999999999e91 < d3 < -1.5000000000000001e-12 or -3.35e-164 < d3 < 1e-107 or 4.00000000000000006e43 < d3 < 1.6000000000000001e179Initial program 91.8%
associate--l+91.8%
distribute-lft-out--91.8%
distribute-rgt-out--94.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 84.0%
Taylor expanded in d3 around 0 77.5%
+-commutative77.5%
Simplified77.5%
if -1.5000000000000001e-12 < d3 < -3.35e-164 or 1e-107 < d3 < 4.00000000000000006e43Initial program 89.6%
associate--l+89.6%
distribute-lft-out--89.6%
distribute-rgt-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 81.5%
Taylor expanded in d3 around 0 71.7%
Final simplification77.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3)))
(t_1 (* d1 (+ d2 d4)))
(t_2 (- (* d1 (+ d1 d3)))))
(if (<= d4 -5e-22)
t_1
(if (<= d4 -2.8e-205)
t_2
(if (<= d4 2.9e-230)
t_0
(if (<= d4 1.95e-166)
t_2
(if (<= d4 8.5e+58)
t_0
(if (<= d4 2.5e+146) t_1 (* d1 (- d4 d3))))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d2 + d4);
double t_2 = -(d1 * (d1 + d3));
double tmp;
if (d4 <= -5e-22) {
tmp = t_1;
} else if (d4 <= -2.8e-205) {
tmp = t_2;
} else if (d4 <= 2.9e-230) {
tmp = t_0;
} else if (d4 <= 1.95e-166) {
tmp = t_2;
} else if (d4 <= 8.5e+58) {
tmp = t_0;
} else if (d4 <= 2.5e+146) {
tmp = t_1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * (d2 + d4)
t_2 = -(d1 * (d1 + d3))
if (d4 <= (-5d-22)) then
tmp = t_1
else if (d4 <= (-2.8d-205)) then
tmp = t_2
else if (d4 <= 2.9d-230) then
tmp = t_0
else if (d4 <= 1.95d-166) then
tmp = t_2
else if (d4 <= 8.5d+58) then
tmp = t_0
else if (d4 <= 2.5d+146) then
tmp = t_1
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d2 + d4);
double t_2 = -(d1 * (d1 + d3));
double tmp;
if (d4 <= -5e-22) {
tmp = t_1;
} else if (d4 <= -2.8e-205) {
tmp = t_2;
} else if (d4 <= 2.9e-230) {
tmp = t_0;
} else if (d4 <= 1.95e-166) {
tmp = t_2;
} else if (d4 <= 8.5e+58) {
tmp = t_0;
} else if (d4 <= 2.5e+146) {
tmp = t_1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d2 + d4) t_2 = -(d1 * (d1 + d3)) tmp = 0 if d4 <= -5e-22: tmp = t_1 elif d4 <= -2.8e-205: tmp = t_2 elif d4 <= 2.9e-230: tmp = t_0 elif d4 <= 1.95e-166: tmp = t_2 elif d4 <= 8.5e+58: tmp = t_0 elif d4 <= 2.5e+146: tmp = t_1 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d2 + d4)) t_2 = Float64(-Float64(d1 * Float64(d1 + d3))) tmp = 0.0 if (d4 <= -5e-22) tmp = t_1; elseif (d4 <= -2.8e-205) tmp = t_2; elseif (d4 <= 2.9e-230) tmp = t_0; elseif (d4 <= 1.95e-166) tmp = t_2; elseif (d4 <= 8.5e+58) tmp = t_0; elseif (d4 <= 2.5e+146) tmp = t_1; else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d2 + d4); t_2 = -(d1 * (d1 + d3)); tmp = 0.0; if (d4 <= -5e-22) tmp = t_1; elseif (d4 <= -2.8e-205) tmp = t_2; elseif (d4 <= 2.9e-230) tmp = t_0; elseif (d4 <= 1.95e-166) tmp = t_2; elseif (d4 <= 8.5e+58) tmp = t_0; elseif (d4 <= 2.5e+146) tmp = t_1; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(d1 * N[(d1 + d3), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[d4, -5e-22], t$95$1, If[LessEqual[d4, -2.8e-205], t$95$2, If[LessEqual[d4, 2.9e-230], t$95$0, If[LessEqual[d4, 1.95e-166], t$95$2, If[LessEqual[d4, 8.5e+58], t$95$0, If[LessEqual[d4, 2.5e+146], t$95$1, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
t_2 := -d1 \cdot \left(d1 + d3\right)\\
\mathbf{if}\;d4 \leq -5 \cdot 10^{-22}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq -2.8 \cdot 10^{-205}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d4 \leq 2.9 \cdot 10^{-230}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.95 \cdot 10^{-166}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d4 \leq 8.5 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 2.5 \cdot 10^{+146}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < -4.99999999999999954e-22 or 8.50000000000000015e58 < d4 < 2.4999999999999999e146Initial program 80.7%
associate--l+80.7%
distribute-lft-out--81.8%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 80.8%
Taylor expanded in d3 around 0 67.8%
+-commutative67.8%
Simplified67.8%
if -4.99999999999999954e-22 < d4 < -2.79999999999999991e-205 or 2.90000000000000005e-230 < d4 < 1.95e-166Initial program 93.8%
associate--l+93.8%
distribute-lft-out--95.9%
distribute-rgt-out--95.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 68.9%
Taylor expanded in d4 around 0 69.0%
*-commutative69.0%
associate-*r*69.0%
neg-mul-169.0%
Simplified69.0%
if -2.79999999999999991e-205 < d4 < 2.90000000000000005e-230 or 1.95e-166 < d4 < 8.50000000000000015e58Initial program 96.4%
associate--l+96.4%
distribute-lft-out--97.6%
distribute-rgt-out--97.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 87.4%
Taylor expanded in d4 around 0 83.1%
if 2.4999999999999999e146 < d4 Initial program 88.2%
associate--l+88.2%
distribute-lft-out--88.2%
distribute-rgt-out--88.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 92.0%
Taylor expanded in d1 around 0 92.0%
Final simplification76.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 2.1e-203)
t_0
(if (<= d4 6.9e-168)
(* d1 (- d1))
(if (<= d4 8.6e+58)
t_0
(if (<= d4 1.1e+146) (* d1 (+ d2 d4)) (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 2.1e-203) {
tmp = t_0;
} else if (d4 <= 6.9e-168) {
tmp = d1 * -d1;
} else if (d4 <= 8.6e+58) {
tmp = t_0;
} else if (d4 <= 1.1e+146) {
tmp = d1 * (d2 + d4);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 2.1d-203) then
tmp = t_0
else if (d4 <= 6.9d-168) then
tmp = d1 * -d1
else if (d4 <= 8.6d+58) then
tmp = t_0
else if (d4 <= 1.1d+146) then
tmp = d1 * (d2 + d4)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 2.1e-203) {
tmp = t_0;
} else if (d4 <= 6.9e-168) {
tmp = d1 * -d1;
} else if (d4 <= 8.6e+58) {
tmp = t_0;
} else if (d4 <= 1.1e+146) {
tmp = d1 * (d2 + d4);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 2.1e-203: tmp = t_0 elif d4 <= 6.9e-168: tmp = d1 * -d1 elif d4 <= 8.6e+58: tmp = t_0 elif d4 <= 1.1e+146: tmp = d1 * (d2 + d4) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 2.1e-203) tmp = t_0; elseif (d4 <= 6.9e-168) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 8.6e+58) tmp = t_0; elseif (d4 <= 1.1e+146) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 2.1e-203) tmp = t_0; elseif (d4 <= 6.9e-168) tmp = d1 * -d1; elseif (d4 <= 8.6e+58) tmp = t_0; elseif (d4 <= 1.1e+146) tmp = d1 * (d2 + d4); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 2.1e-203], t$95$0, If[LessEqual[d4, 6.9e-168], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 8.6e+58], t$95$0, If[LessEqual[d4, 1.1e+146], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 2.1 \cdot 10^{-203}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 6.9 \cdot 10^{-168}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 8.6 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.1 \cdot 10^{+146}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 2.10000000000000002e-203 or 6.9e-168 < d4 < 8.59999999999999982e58Initial program 89.8%
associate--l+89.8%
distribute-lft-out--91.3%
distribute-rgt-out--94.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.8%
Taylor expanded in d4 around 0 66.4%
if 2.10000000000000002e-203 < d4 < 6.9e-168Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 50.8%
unpow250.8%
neg-mul-150.8%
Simplified50.8%
if 8.59999999999999982e58 < d4 < 1.0999999999999999e146Initial program 88.9%
associate--l+88.9%
distribute-lft-out--88.9%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 83.4%
Taylor expanded in d3 around 0 72.7%
+-commutative72.7%
Simplified72.7%
if 1.0999999999999999e146 < d4 Initial program 88.2%
associate--l+88.2%
distribute-lft-out--88.2%
distribute-rgt-out--88.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 92.0%
Taylor expanded in d1 around 0 92.0%
Final simplification69.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -6.4e+142)
(* d1 (+ d2 d4))
(if (or (<= d2 -8.5e+80) (not (<= d2 -3.8e+22)))
(* d1 (- d4 (+ d1 d3)))
(* d1 (- d2 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6.4e+142) {
tmp = d1 * (d2 + d4);
} else if ((d2 <= -8.5e+80) || !(d2 <= -3.8e+22)) {
tmp = d1 * (d4 - (d1 + d3));
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-6.4d+142)) then
tmp = d1 * (d2 + d4)
else if ((d2 <= (-8.5d+80)) .or. (.not. (d2 <= (-3.8d+22)))) then
tmp = d1 * (d4 - (d1 + d3))
else
tmp = d1 * (d2 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6.4e+142) {
tmp = d1 * (d2 + d4);
} else if ((d2 <= -8.5e+80) || !(d2 <= -3.8e+22)) {
tmp = d1 * (d4 - (d1 + d3));
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -6.4e+142: tmp = d1 * (d2 + d4) elif (d2 <= -8.5e+80) or not (d2 <= -3.8e+22): tmp = d1 * (d4 - (d1 + d3)) else: tmp = d1 * (d2 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -6.4e+142) tmp = Float64(d1 * Float64(d2 + d4)); elseif ((d2 <= -8.5e+80) || !(d2 <= -3.8e+22)) tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(d2 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -6.4e+142) tmp = d1 * (d2 + d4); elseif ((d2 <= -8.5e+80) || ~((d2 <= -3.8e+22))) tmp = d1 * (d4 - (d1 + d3)); else tmp = d1 * (d2 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -6.4e+142], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d2, -8.5e+80], N[Not[LessEqual[d2, -3.8e+22]], $MachinePrecision]], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -6.4 \cdot 10^{+142}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d2 \leq -8.5 \cdot 10^{+80} \lor \neg \left(d2 \leq -3.8 \cdot 10^{+22}\right):\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\end{array}
\end{array}
if d2 < -6.40000000000000011e142Initial program 77.3%
associate--l+77.3%
distribute-lft-out--80.5%
distribute-rgt-out--80.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 93.4%
Taylor expanded in d3 around 0 92.5%
+-commutative92.5%
Simplified92.5%
if -6.40000000000000011e142 < d2 < -8.50000000000000007e80 or -3.8000000000000004e22 < d2 Initial program 91.1%
associate--l+91.1%
distribute-lft-out--92.0%
distribute-rgt-out--95.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 83.2%
if -8.50000000000000007e80 < d2 < -3.8000000000000004e22Initial program 91.7%
associate--l+91.7%
distribute-lft-out--91.5%
distribute-rgt-out--91.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 91.5%
Taylor expanded in d4 around 0 59.6%
Final simplification83.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 2.1e-203)
t_0
(if (<= d4 8e-168)
(* d1 (- d1))
(if (<= d4 7.8e+58) t_0 (* d1 (+ d2 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 2.1e-203) {
tmp = t_0;
} else if (d4 <= 8e-168) {
tmp = d1 * -d1;
} else if (d4 <= 7.8e+58) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 2.1d-203) then
tmp = t_0
else if (d4 <= 8d-168) then
tmp = d1 * -d1
else if (d4 <= 7.8d+58) then
tmp = t_0
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 2.1e-203) {
tmp = t_0;
} else if (d4 <= 8e-168) {
tmp = d1 * -d1;
} else if (d4 <= 7.8e+58) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 2.1e-203: tmp = t_0 elif d4 <= 8e-168: tmp = d1 * -d1 elif d4 <= 7.8e+58: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 2.1e-203) tmp = t_0; elseif (d4 <= 8e-168) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 7.8e+58) tmp = t_0; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 2.1e-203) tmp = t_0; elseif (d4 <= 8e-168) tmp = d1 * -d1; elseif (d4 <= 7.8e+58) tmp = t_0; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 2.1e-203], t$95$0, If[LessEqual[d4, 8e-168], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 7.8e+58], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 2.1 \cdot 10^{-203}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 8 \cdot 10^{-168}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 7.8 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 2.10000000000000002e-203 or 8.0000000000000004e-168 < d4 < 7.8000000000000002e58Initial program 89.8%
associate--l+89.8%
distribute-lft-out--91.3%
distribute-rgt-out--94.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.8%
Taylor expanded in d4 around 0 66.4%
if 2.10000000000000002e-203 < d4 < 8.0000000000000004e-168Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 50.8%
unpow250.8%
neg-mul-150.8%
Simplified50.8%
if 7.8000000000000002e58 < d4 Initial program 88.5%
associate--l+88.5%
distribute-lft-out--88.5%
distribute-rgt-out--90.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 94.2%
Taylor expanded in d3 around 0 86.7%
+-commutative86.7%
Simplified86.7%
Final simplification70.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -1.5e+89) (not (<= d1 7.5e+20))) (* d1 (- d4 (+ d1 d3))) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1.5e+89) || !(d1 <= 7.5e+20)) {
tmp = d1 * (d4 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d1 <= (-1.5d+89)) .or. (.not. (d1 <= 7.5d+20))) then
tmp = d1 * (d4 - (d1 + d3))
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1.5e+89) || !(d1 <= 7.5e+20)) {
tmp = d1 * (d4 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -1.5e+89) or not (d1 <= 7.5e+20): tmp = d1 * (d4 - (d1 + d3)) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -1.5e+89) || !(d1 <= 7.5e+20)) tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -1.5e+89) || ~((d1 <= 7.5e+20))) tmp = d1 * (d4 - (d1 + d3)); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -1.5e+89], N[Not[LessEqual[d1, 7.5e+20]], $MachinePrecision]], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -1.5 \cdot 10^{+89} \lor \neg \left(d1 \leq 7.5 \cdot 10^{+20}\right):\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -1.50000000000000006e89 or 7.5e20 < d1 Initial program 74.0%
associate--l+74.0%
distribute-lft-out--76.9%
distribute-rgt-out--84.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 86.9%
if -1.50000000000000006e89 < d1 < 7.5e20Initial program 100.0%
associate--l+100.0%
distribute-lft-out--99.9%
distribute-rgt-out--99.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 97.4%
Final simplification93.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 2.9e-230)
(* d1 d2)
(if (<= d4 6.1e-167)
(* d1 (- d1))
(if (<= d4 1.3e+59) (* d1 (- d3)) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e-230) {
tmp = d1 * d2;
} else if (d4 <= 6.1e-167) {
tmp = d1 * -d1;
} else if (d4 <= 1.3e+59) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2.9d-230) then
tmp = d1 * d2
else if (d4 <= 6.1d-167) then
tmp = d1 * -d1
else if (d4 <= 1.3d+59) then
tmp = d1 * -d3
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e-230) {
tmp = d1 * d2;
} else if (d4 <= 6.1e-167) {
tmp = d1 * -d1;
} else if (d4 <= 1.3e+59) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.9e-230: tmp = d1 * d2 elif d4 <= 6.1e-167: tmp = d1 * -d1 elif d4 <= 1.3e+59: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.9e-230) tmp = Float64(d1 * d2); elseif (d4 <= 6.1e-167) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 1.3e+59) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.9e-230) tmp = d1 * d2; elseif (d4 <= 6.1e-167) tmp = d1 * -d1; elseif (d4 <= 1.3e+59) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.9e-230], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 6.1e-167], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 1.3e+59], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.9 \cdot 10^{-230}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 6.1 \cdot 10^{-167}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 1.3 \cdot 10^{+59}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.90000000000000005e-230Initial program 87.4%
associate--l+87.4%
distribute-lft-out--88.8%
distribute-rgt-out--93.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.3%
if 2.90000000000000005e-230 < d4 < 6.0999999999999998e-167Initial program 86.7%
associate--l+86.7%
distribute-lft-out--93.3%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 41.1%
unpow241.1%
neg-mul-141.1%
Simplified41.1%
if 6.0999999999999998e-167 < d4 < 1.3e59Initial program 97.8%
associate--l+97.8%
distribute-lft-out--97.8%
distribute-rgt-out--97.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 51.9%
mul-1-neg51.9%
distribute-rgt-neg-out51.9%
Simplified51.9%
if 1.3e59 < d4 Initial program 88.5%
associate--l+88.5%
distribute-lft-out--88.5%
distribute-rgt-out--90.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 70.3%
Final simplification42.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 4.4e-232)
(* d1 d2)
(if (<= d4 1.46e-165)
(* d1 (- d1))
(if (<= d4 1.22e+51) (* d1 d2) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.4e-232) {
tmp = d1 * d2;
} else if (d4 <= 1.46e-165) {
tmp = d1 * -d1;
} else if (d4 <= 1.22e+51) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 4.4d-232) then
tmp = d1 * d2
else if (d4 <= 1.46d-165) then
tmp = d1 * -d1
else if (d4 <= 1.22d+51) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.4e-232) {
tmp = d1 * d2;
} else if (d4 <= 1.46e-165) {
tmp = d1 * -d1;
} else if (d4 <= 1.22e+51) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 4.4e-232: tmp = d1 * d2 elif d4 <= 1.46e-165: tmp = d1 * -d1 elif d4 <= 1.22e+51: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 4.4e-232) tmp = Float64(d1 * d2); elseif (d4 <= 1.46e-165) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 1.22e+51) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 4.4e-232) tmp = d1 * d2; elseif (d4 <= 1.46e-165) tmp = d1 * -d1; elseif (d4 <= 1.22e+51) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 4.4e-232], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.46e-165], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 1.22e+51], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 4.4 \cdot 10^{-232}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.46 \cdot 10^{-165}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 1.22 \cdot 10^{+51}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 4.40000000000000004e-232 or 1.4600000000000001e-165 < d4 < 1.22000000000000005e51Initial program 89.9%
associate--l+89.9%
distribute-lft-out--90.9%
distribute-rgt-out--94.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 32.6%
if 4.40000000000000004e-232 < d4 < 1.4600000000000001e-165Initial program 86.7%
associate--l+86.7%
distribute-lft-out--93.3%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 41.1%
unpow241.1%
neg-mul-141.1%
Simplified41.1%
if 1.22000000000000005e51 < d4 Initial program 88.7%
associate--l+88.7%
distribute-lft-out--88.7%
distribute-rgt-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 69.0%
Final simplification40.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -2.35e+92) (not (<= d3 8e+178))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.35e+92) || !(d3 <= 8e+178)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-2.35d+92)) .or. (.not. (d3 <= 8d+178))) then
tmp = d1 * -d3
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.35e+92) || !(d3 <= 8e+178)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -2.35e+92) or not (d3 <= 8e+178): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -2.35e+92) || !(d3 <= 8e+178)) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -2.35e+92) || ~((d3 <= 8e+178))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -2.35e+92], N[Not[LessEqual[d3, 8e+178]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -2.35 \cdot 10^{+92} \lor \neg \left(d3 \leq 8 \cdot 10^{+178}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -2.35e92 or 8.0000000000000004e178 < d3 Initial program 85.5%
associate--l+85.5%
distribute-lft-out--89.4%
distribute-rgt-out--92.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 83.1%
mul-1-neg83.1%
distribute-rgt-neg-out83.1%
Simplified83.1%
if -2.35e92 < d3 < 8.0000000000000004e178Initial program 91.1%
associate--l+91.1%
distribute-lft-out--91.1%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 79.0%
Taylor expanded in d3 around 0 71.5%
+-commutative71.5%
Simplified71.5%
Final simplification74.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.8e+52) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.8e+52) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2.8d+52) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.8e+52) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.8e+52: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.8e+52) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.8e+52) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.8e+52], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.8 \cdot 10^{+52}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.8e52Initial program 89.6%
associate--l+89.6%
distribute-lft-out--91.1%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.7%
if 2.8e52 < d4 Initial program 88.7%
associate--l+88.7%
distribute-lft-out--88.7%
distribute-rgt-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 69.0%
Final simplification41.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d4))
double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d4
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
def code(d1, d2, d3, d4): return d1 * d4
function code(d1, d2, d3, d4) return Float64(d1 * d4) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d4; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d4), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d4
\end{array}
Initial program 89.4%
associate--l+89.4%
distribute-lft-out--90.6%
distribute-rgt-out--93.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 32.1%
Final simplification32.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ (- d2 d3) d4) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (((d2 - d3) + d4) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
def code(d1, d2, d3, d4): return d1 * (((d2 - d3) + d4) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(Float64(d2 - d3) + d4) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (((d2 - d3) + d4) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(N[(d2 - d3), $MachinePrecision] + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)
\end{array}
herbie shell --seed 2023188
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:herbie-target
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))