
(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 13 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 85.5%
associate--l+85.5%
distribute-lft-out--86.3%
distribute-rgt-out--90.6%
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 -2.45e+117)
t_1
(if (<= d3 -9.6e-150)
t_2
(if (<= d3 -4.4e-279)
t_0
(if (<= d3 2.6e-164) t_2 (if (<= d3 5.2e+136) t_0 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 <= -2.45e+117) {
tmp = t_1;
} else if (d3 <= -9.6e-150) {
tmp = t_2;
} else if (d3 <= -4.4e-279) {
tmp = t_0;
} else if (d3 <= 2.6e-164) {
tmp = t_2;
} else if (d3 <= 5.2e+136) {
tmp = t_0;
} 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 <= (-2.45d+117)) then
tmp = t_1
else if (d3 <= (-9.6d-150)) then
tmp = t_2
else if (d3 <= (-4.4d-279)) then
tmp = t_0
else if (d3 <= 2.6d-164) then
tmp = t_2
else if (d3 <= 5.2d+136) then
tmp = t_0
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 <= -2.45e+117) {
tmp = t_1;
} else if (d3 <= -9.6e-150) {
tmp = t_2;
} else if (d3 <= -4.4e-279) {
tmp = t_0;
} else if (d3 <= 2.6e-164) {
tmp = t_2;
} else if (d3 <= 5.2e+136) {
tmp = t_0;
} 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 <= -2.45e+117: tmp = t_1 elif d3 <= -9.6e-150: tmp = t_2 elif d3 <= -4.4e-279: tmp = t_0 elif d3 <= 2.6e-164: tmp = t_2 elif d3 <= 5.2e+136: tmp = t_0 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 <= -2.45e+117) tmp = t_1; elseif (d3 <= -9.6e-150) tmp = t_2; elseif (d3 <= -4.4e-279) tmp = t_0; elseif (d3 <= 2.6e-164) tmp = t_2; elseif (d3 <= 5.2e+136) tmp = t_0; 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 <= -2.45e+117) tmp = t_1; elseif (d3 <= -9.6e-150) tmp = t_2; elseif (d3 <= -4.4e-279) tmp = t_0; elseif (d3 <= 2.6e-164) tmp = t_2; elseif (d3 <= 5.2e+136) tmp = t_0; 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, -2.45e+117], t$95$1, If[LessEqual[d3, -9.6e-150], t$95$2, If[LessEqual[d3, -4.4e-279], t$95$0, If[LessEqual[d3, 2.6e-164], t$95$2, If[LessEqual[d3, 5.2e+136], t$95$0, 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 -2.45 \cdot 10^{+117}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -9.6 \cdot 10^{-150}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq -4.4 \cdot 10^{-279}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 2.6 \cdot 10^{-164}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 5.2 \cdot 10^{+136}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d3 < -2.45e117 or 5.2000000000000003e136 < d3 Initial program 80.7%
associate--l+80.7%
distribute-lft-out--82.0%
distribute-rgt-out--84.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 75.4%
associate-*r*75.4%
neg-mul-175.4%
*-commutative75.4%
Simplified75.4%
if -2.45e117 < d3 < -9.6e-150 or -4.40000000000000001e-279 < d3 < 2.6000000000000002e-164Initial program 86.0%
associate--l+86.0%
distribute-lft-out--86.0%
distribute-rgt-out--92.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.5%
Taylor expanded in d1 around 0 78.2%
if -9.6e-150 < d3 < -4.40000000000000001e-279 or 2.6000000000000002e-164 < d3 < 5.2000000000000003e136Initial program 89.7%
associate--l+89.7%
distribute-lft-out--91.0%
distribute-rgt-out--94.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.1%
Taylor expanded in d2 around 0 74.9%
Final simplification76.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (+ d2 d4))))
(if (<= d3 -7.1e+115)
t_0
(if (<= d3 -1e-200)
t_1
(if (<= d3 -1.05e-282)
(* d1 (- d2 d1))
(if (<= d3 5.5e-165)
t_1
(if (<= d3 5.2e+122) (* d1 (- d4 d1)) t_0)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d2 + d4);
double tmp;
if (d3 <= -7.1e+115) {
tmp = t_0;
} else if (d3 <= -1e-200) {
tmp = t_1;
} else if (d3 <= -1.05e-282) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 5.5e-165) {
tmp = t_1;
} else if (d3 <= 5.2e+122) {
tmp = d1 * (d4 - d1);
} else {
tmp = t_0;
}
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) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * (d2 + d4)
if (d3 <= (-7.1d+115)) then
tmp = t_0
else if (d3 <= (-1d-200)) then
tmp = t_1
else if (d3 <= (-1.05d-282)) then
tmp = d1 * (d2 - d1)
else if (d3 <= 5.5d-165) then
tmp = t_1
else if (d3 <= 5.2d+122) then
tmp = d1 * (d4 - d1)
else
tmp = t_0
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 tmp;
if (d3 <= -7.1e+115) {
tmp = t_0;
} else if (d3 <= -1e-200) {
tmp = t_1;
} else if (d3 <= -1.05e-282) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 5.5e-165) {
tmp = t_1;
} else if (d3 <= 5.2e+122) {
tmp = d1 * (d4 - d1);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d2 + d4) tmp = 0 if d3 <= -7.1e+115: tmp = t_0 elif d3 <= -1e-200: tmp = t_1 elif d3 <= -1.05e-282: tmp = d1 * (d2 - d1) elif d3 <= 5.5e-165: tmp = t_1 elif d3 <= 5.2e+122: tmp = d1 * (d4 - d1) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -7.1e+115) tmp = t_0; elseif (d3 <= -1e-200) tmp = t_1; elseif (d3 <= -1.05e-282) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 5.5e-165) tmp = t_1; elseif (d3 <= 5.2e+122) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -7.1e+115) tmp = t_0; elseif (d3 <= -1e-200) tmp = t_1; elseif (d3 <= -1.05e-282) tmp = d1 * (d2 - d1); elseif (d3 <= 5.5e-165) tmp = t_1; elseif (d3 <= 5.2e+122) tmp = d1 * (d4 - d1); else tmp = t_0; 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]}, If[LessEqual[d3, -7.1e+115], t$95$0, If[LessEqual[d3, -1e-200], t$95$1, If[LessEqual[d3, -1.05e-282], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 5.5e-165], t$95$1, If[LessEqual[d3, 5.2e+122], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -7.1 \cdot 10^{+115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -1 \cdot 10^{-200}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -1.05 \cdot 10^{-282}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 5.5 \cdot 10^{-165}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 5.2 \cdot 10^{+122}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -7.0999999999999997e115 or 5.20000000000000015e122 < d3 Initial program 81.4%
associate--l+81.4%
distribute-lft-out--82.7%
distribute-rgt-out--85.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 92.1%
Taylor expanded in d1 around 0 88.4%
if -7.0999999999999997e115 < d3 < -9.9999999999999998e-201 or -1.05000000000000006e-282 < d3 < 5.49999999999999969e-165Initial program 85.5%
associate--l+85.5%
distribute-lft-out--85.5%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.6%
Taylor expanded in d1 around 0 79.0%
if -9.9999999999999998e-201 < d3 < -1.05000000000000006e-282Initial program 75.0%
associate--l+75.0%
distribute-lft-out--75.0%
distribute-rgt-out--80.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d4 around 0 85.7%
if 5.49999999999999969e-165 < d3 < 5.20000000000000015e122Initial program 96.0%
associate--l+96.0%
distribute-lft-out--98.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.8%
Taylor expanded in d2 around 0 75.1%
Final simplification81.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -6.6e-282)
(* d1 d2)
(if (<= d4 27000000.0)
(* d1 (- d3))
(if (<= d4 3.5e+70)
(* d1 d2)
(if (<= d4 2.35e+84) (- (* d1 d1)) (* d1 d4))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -6.6e-282) {
tmp = d1 * d2;
} else if (d4 <= 27000000.0) {
tmp = d1 * -d3;
} else if (d4 <= 3.5e+70) {
tmp = d1 * d2;
} else if (d4 <= 2.35e+84) {
tmp = -(d1 * d1);
} 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 <= (-6.6d-282)) then
tmp = d1 * d2
else if (d4 <= 27000000.0d0) then
tmp = d1 * -d3
else if (d4 <= 3.5d+70) then
tmp = d1 * d2
else if (d4 <= 2.35d+84) then
tmp = -(d1 * d1)
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 <= -6.6e-282) {
tmp = d1 * d2;
} else if (d4 <= 27000000.0) {
tmp = d1 * -d3;
} else if (d4 <= 3.5e+70) {
tmp = d1 * d2;
} else if (d4 <= 2.35e+84) {
tmp = -(d1 * d1);
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -6.6e-282: tmp = d1 * d2 elif d4 <= 27000000.0: tmp = d1 * -d3 elif d4 <= 3.5e+70: tmp = d1 * d2 elif d4 <= 2.35e+84: tmp = -(d1 * d1) else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -6.6e-282) tmp = Float64(d1 * d2); elseif (d4 <= 27000000.0) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 3.5e+70) tmp = Float64(d1 * d2); elseif (d4 <= 2.35e+84) tmp = Float64(-Float64(d1 * d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= -6.6e-282) tmp = d1 * d2; elseif (d4 <= 27000000.0) tmp = d1 * -d3; elseif (d4 <= 3.5e+70) tmp = d1 * d2; elseif (d4 <= 2.35e+84) tmp = -(d1 * d1); else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -6.6e-282], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 27000000.0], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 3.5e+70], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 2.35e+84], (-N[(d1 * d1), $MachinePrecision]), N[(d1 * d4), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -6.6 \cdot 10^{-282}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 27000000:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 3.5 \cdot 10^{+70}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 2.35 \cdot 10^{+84}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -6.6e-282 or 2.7e7 < d4 < 3.50000000000000002e70Initial program 81.6%
associate--l+81.6%
distribute-lft-out--82.4%
distribute-rgt-out--88.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 29.0%
if -6.6e-282 < d4 < 2.7e7Initial program 89.2%
associate--l+89.2%
distribute-lft-out--89.2%
distribute-rgt-out--89.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 41.8%
associate-*r*41.8%
neg-mul-141.8%
*-commutative41.8%
Simplified41.8%
if 3.50000000000000002e70 < d4 < 2.3499999999999999e84Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 100.0%
unpow2100.0%
mul-1-neg100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
if 2.3499999999999999e84 < d4 Initial program 89.8%
associate--l+89.8%
distribute-lft-out--91.5%
distribute-rgt-out--96.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 74.8%
Final simplification43.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -3.6e+117) (not (<= d3 2.3e+64))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.6e+117) || !(d3 <= 2.3e+64)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
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 <= (-3.6d+117)) .or. (.not. (d3 <= 2.3d+64))) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * ((d2 + d4) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.6e+117) || !(d3 <= 2.3e+64)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -3.6e+117) or not (d3 <= 2.3e+64): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -3.6e+117) || !(d3 <= 2.3e+64)) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -3.6e+117) || ~((d3 <= 2.3e+64))) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -3.6e+117], N[Not[LessEqual[d3, 2.3e+64]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -3.6 \cdot 10^{+117} \lor \neg \left(d3 \leq 2.3 \cdot 10^{+64}\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -3.60000000000000013e117 or 2.3e64 < d3 Initial program 82.2%
associate--l+82.2%
distribute-lft-out--84.4%
distribute-rgt-out--86.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 94.4%
if -3.60000000000000013e117 < d3 < 2.3e64Initial program 87.3%
associate--l+87.3%
distribute-lft-out--87.3%
distribute-rgt-out--92.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.2%
Final simplification95.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -1.24e+117) (* d1 (- d2 d3)) (if (<= d3 3.2e+160) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1.24e+117) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 3.2e+160) {
tmp = d1 * ((d2 + d4) - d1);
} 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) :: tmp
if (d3 <= (-1.24d+117)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 3.2d+160) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1.24e+117) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 3.2e+160) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -1.24e+117: tmp = d1 * (d2 - d3) elif d3 <= 3.2e+160: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -1.24e+117) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 3.2e+160) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -1.24e+117) tmp = d1 * (d2 - d3); elseif (d3 <= 3.2e+160) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -1.24e+117], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 3.2e+160], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.24 \cdot 10^{+117}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 3.2 \cdot 10^{+160}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -1.23999999999999998e117Initial program 83.3%
associate--l+83.3%
distribute-lft-out--85.7%
distribute-rgt-out--88.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.2%
Taylor expanded in d1 around 0 86.8%
if -1.23999999999999998e117 < d3 < 3.1999999999999998e160Initial program 87.5%
associate--l+87.5%
distribute-lft-out--88.1%
distribute-rgt-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.4%
if 3.1999999999999998e160 < d3 Initial program 75.8%
associate--l+75.8%
distribute-lft-out--75.9%
distribute-rgt-out--79.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 93.1%
Taylor expanded in d2 around 0 78.7%
Final simplification90.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -1.4e-268)
(* d1 d2)
(if (<= d4 3.5e-119)
(- (* d1 d1))
(if (<= d4 5.8e+74) (* d1 d2) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.4e-268) {
tmp = d1 * d2;
} else if (d4 <= 3.5e-119) {
tmp = -(d1 * d1);
} else if (d4 <= 5.8e+74) {
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 <= (-1.4d-268)) then
tmp = d1 * d2
else if (d4 <= 3.5d-119) then
tmp = -(d1 * d1)
else if (d4 <= 5.8d+74) 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 <= -1.4e-268) {
tmp = d1 * d2;
} else if (d4 <= 3.5e-119) {
tmp = -(d1 * d1);
} else if (d4 <= 5.8e+74) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -1.4e-268: tmp = d1 * d2 elif d4 <= 3.5e-119: tmp = -(d1 * d1) elif d4 <= 5.8e+74: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -1.4e-268) tmp = Float64(d1 * d2); elseif (d4 <= 3.5e-119) tmp = Float64(-Float64(d1 * d1)); elseif (d4 <= 5.8e+74) 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 <= -1.4e-268) tmp = d1 * d2; elseif (d4 <= 3.5e-119) tmp = -(d1 * d1); elseif (d4 <= 5.8e+74) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -1.4e-268], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 3.5e-119], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d4, 5.8e+74], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -1.4 \cdot 10^{-268}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 3.5 \cdot 10^{-119}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d4 \leq 5.8 \cdot 10^{+74}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -1.40000000000000008e-268 or 3.5e-119 < d4 < 5.8000000000000005e74Initial program 82.5%
associate--l+82.5%
distribute-lft-out--83.2%
distribute-rgt-out--88.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 29.3%
if -1.40000000000000008e-268 < d4 < 3.5e-119Initial program 88.7%
associate--l+88.7%
distribute-lft-out--88.7%
distribute-rgt-out--88.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 43.7%
unpow243.7%
mul-1-neg43.7%
distribute-rgt-neg-out43.7%
Simplified43.7%
if 5.8000000000000005e74 < d4 Initial program 89.9%
associate--l+89.9%
distribute-lft-out--91.6%
distribute-rgt-out--96.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 73.7%
Final simplification42.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.54e+119) (not (<= d3 8e+163))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.54e+119) || !(d3 <= 8e+163)) {
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 <= (-1.54d+119)) .or. (.not. (d3 <= 8d+163))) 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 <= -1.54e+119) || !(d3 <= 8e+163)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.54e+119) or not (d3 <= 8e+163): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.54e+119) || !(d3 <= 8e+163)) 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 <= -1.54e+119) || ~((d3 <= 8e+163))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.54e+119], N[Not[LessEqual[d3, 8e+163]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.54 \cdot 10^{+119} \lor \neg \left(d3 \leq 8 \cdot 10^{+163}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.5399999999999999e119 or 7.9999999999999995e163 < d3 Initial program 80.2%
associate--l+80.2%
distribute-lft-out--81.7%
distribute-rgt-out--84.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 78.1%
associate-*r*78.1%
neg-mul-178.1%
*-commutative78.1%
Simplified78.1%
if -1.5399999999999999e119 < d3 < 7.9999999999999995e163Initial program 87.5%
associate--l+87.5%
distribute-lft-out--88.1%
distribute-rgt-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.4%
Taylor expanded in d1 around 0 70.7%
Final simplification72.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.75e-132) (* d1 (- d2 d1)) (if (<= d4 4.5e-49) (* d1 (- d3)) (* d1 (+ d2 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.75e-132) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 4.5e-49) {
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 (d4 <= 2.75d-132) then
tmp = d1 * (d2 - d1)
else if (d4 <= 4.5d-49) 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 (d4 <= 2.75e-132) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 4.5e-49) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.75e-132: tmp = d1 * (d2 - d1) elif d4 <= 4.5e-49: tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.75e-132) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 4.5e-49) 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 (d4 <= 2.75e-132) tmp = d1 * (d2 - d1); elseif (d4 <= 4.5e-49) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.75e-132], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 4.5e-49], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.75 \cdot 10^{-132}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 4.5 \cdot 10^{-49}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 2.75e-132Initial program 81.7%
associate--l+81.7%
distribute-lft-out--82.3%
distribute-rgt-out--87.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.2%
Taylor expanded in d4 around 0 57.7%
if 2.75e-132 < d4 < 4.5000000000000002e-49Initial program 93.3%
associate--l+93.3%
distribute-lft-out--93.2%
distribute-rgt-out--93.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 61.4%
associate-*r*61.4%
neg-mul-161.4%
*-commutative61.4%
Simplified61.4%
if 4.5000000000000002e-49 < d4 Initial program 92.1%
associate--l+92.1%
distribute-lft-out--93.4%
distribute-rgt-out--97.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 84.1%
Taylor expanded in d1 around 0 78.1%
Final simplification64.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.2e+84) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.2e+84) {
tmp = d1 * (d2 - (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 (d4 <= 2.2d+84) then
tmp = d1 * (d2 - (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 (d4 <= 2.2e+84) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.2e+84: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.2e+84) tmp = Float64(d1 * Float64(d2 - 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 (d4 <= 2.2e+84) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.2e+84], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.2 \cdot 10^{+84}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 2.1999999999999998e84Initial program 84.2%
associate--l+84.2%
distribute-lft-out--84.7%
distribute-rgt-out--88.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 83.1%
if 2.1999999999999998e84 < d4 Initial program 89.8%
associate--l+89.8%
distribute-lft-out--91.5%
distribute-rgt-out--96.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 98.3%
Final simplification86.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.85e+51) (* d1 (- d2 d3)) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.85e+51) {
tmp = d1 * (d2 - d3);
} 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) :: tmp
if (d2 <= (-2.85d+51)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.85e+51) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.85e+51: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.85e+51) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.85e+51) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.85e+51], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.85 \cdot 10^{+51}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -2.8500000000000001e51Initial program 75.5%
associate--l+75.5%
distribute-lft-out--77.7%
distribute-rgt-out--79.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.5%
Taylor expanded in d1 around 0 84.5%
if -2.8500000000000001e51 < d2 Initial program 87.6%
associate--l+87.6%
distribute-lft-out--88.1%
distribute-rgt-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 78.4%
Taylor expanded in d2 around 0 62.4%
Final simplification66.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.7e+75) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.7e+75) {
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.7d+75) 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.7e+75) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.7e+75: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.7e+75) 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.7e+75) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.7e+75], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.7 \cdot 10^{+75}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.69999999999999998e75Initial program 84.2%
associate--l+84.2%
distribute-lft-out--84.7%
distribute-rgt-out--88.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.5%
if 2.69999999999999998e75 < d4 Initial program 89.9%
associate--l+89.9%
distribute-lft-out--91.6%
distribute-rgt-out--96.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 73.7%
Final simplification40.7%
(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 85.5%
associate--l+85.5%
distribute-lft-out--86.3%
distribute-rgt-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 35.1%
Final simplification35.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 2023199
(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)))