
(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 87.8%
associate--l+87.8%
distribute-lft-out--89.0%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d1 (- d3))))
(if (<= d4 -1.55e-44)
(* d1 d2)
(if (<= d4 2.2e-282)
t_1
(if (<= d4 8.5e-257)
t_0
(if (<= d4 3.6e-115)
t_1
(if (<= d4 6.8e-72)
t_0
(if (<= d4 1.8e+59)
t_1
(if (<= d4 4.8e+105) (* d1 d2) (* d1 d4))))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * -d3;
double tmp;
if (d4 <= -1.55e-44) {
tmp = d1 * d2;
} else if (d4 <= 2.2e-282) {
tmp = t_1;
} else if (d4 <= 8.5e-257) {
tmp = t_0;
} else if (d4 <= 3.6e-115) {
tmp = t_1;
} else if (d4 <= 6.8e-72) {
tmp = t_0;
} else if (d4 <= 1.8e+59) {
tmp = t_1;
} else if (d4 <= 4.8e+105) {
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * -d1
t_1 = d1 * -d3
if (d4 <= (-1.55d-44)) then
tmp = d1 * d2
else if (d4 <= 2.2d-282) then
tmp = t_1
else if (d4 <= 8.5d-257) then
tmp = t_0
else if (d4 <= 3.6d-115) then
tmp = t_1
else if (d4 <= 6.8d-72) then
tmp = t_0
else if (d4 <= 1.8d+59) then
tmp = t_1
else if (d4 <= 4.8d+105) 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 t_0 = d1 * -d1;
double t_1 = d1 * -d3;
double tmp;
if (d4 <= -1.55e-44) {
tmp = d1 * d2;
} else if (d4 <= 2.2e-282) {
tmp = t_1;
} else if (d4 <= 8.5e-257) {
tmp = t_0;
} else if (d4 <= 3.6e-115) {
tmp = t_1;
} else if (d4 <= 6.8e-72) {
tmp = t_0;
} else if (d4 <= 1.8e+59) {
tmp = t_1;
} else if (d4 <= 4.8e+105) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = d1 * -d3 tmp = 0 if d4 <= -1.55e-44: tmp = d1 * d2 elif d4 <= 2.2e-282: tmp = t_1 elif d4 <= 8.5e-257: tmp = t_0 elif d4 <= 3.6e-115: tmp = t_1 elif d4 <= 6.8e-72: tmp = t_0 elif d4 <= 1.8e+59: tmp = t_1 elif d4 <= 4.8e+105: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d4 <= -1.55e-44) tmp = Float64(d1 * d2); elseif (d4 <= 2.2e-282) tmp = t_1; elseif (d4 <= 8.5e-257) tmp = t_0; elseif (d4 <= 3.6e-115) tmp = t_1; elseif (d4 <= 6.8e-72) tmp = t_0; elseif (d4 <= 1.8e+59) tmp = t_1; elseif (d4 <= 4.8e+105) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = d1 * -d3; tmp = 0.0; if (d4 <= -1.55e-44) tmp = d1 * d2; elseif (d4 <= 2.2e-282) tmp = t_1; elseif (d4 <= 8.5e-257) tmp = t_0; elseif (d4 <= 3.6e-115) tmp = t_1; elseif (d4 <= 6.8e-72) tmp = t_0; elseif (d4 <= 1.8e+59) tmp = t_1; elseif (d4 <= 4.8e+105) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d4, -1.55e-44], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 2.2e-282], t$95$1, If[LessEqual[d4, 8.5e-257], t$95$0, If[LessEqual[d4, 3.6e-115], t$95$1, If[LessEqual[d4, 6.8e-72], t$95$0, If[LessEqual[d4, 1.8e+59], t$95$1, If[LessEqual[d4, 4.8e+105], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq -1.55 \cdot 10^{-44}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 2.2 \cdot 10^{-282}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 8.5 \cdot 10^{-257}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 3.6 \cdot 10^{-115}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 6.8 \cdot 10^{-72}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.8 \cdot 10^{+59}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 4.8 \cdot 10^{+105}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -1.54999999999999992e-44 or 1.7999999999999999e59 < d4 < 4.7999999999999995e105Initial program 83.5%
associate--l+83.5%
distribute-lft-out--84.8%
distribute-rgt-out--91.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 24.6%
if -1.54999999999999992e-44 < d4 < 2.19999999999999981e-282 or 8.5000000000000002e-257 < d4 < 3.60000000000000009e-115 or 6.7999999999999997e-72 < d4 < 1.7999999999999999e59Initial program 92.7%
associate--l+92.7%
distribute-lft-out--94.5%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 57.9%
associate-*r*57.9%
neg-mul-157.9%
*-commutative57.9%
Simplified57.9%
if 2.19999999999999981e-282 < d4 < 8.5000000000000002e-257 or 3.60000000000000009e-115 < d4 < 6.7999999999999997e-72Initial program 94.0%
associate--l+94.0%
distribute-lft-out--94.1%
distribute-rgt-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 54.5%
unpow254.5%
mul-1-neg54.5%
distribute-rgt-neg-out54.5%
Simplified54.5%
if 4.7999999999999995e105 < d4 Initial program 82.0%
associate--l+82.0%
distribute-lft-out--82.0%
distribute-rgt-out--88.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 68.6%
Final simplification49.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d1 (- d3))) (t_2 (* d1 (+ d2 d4))))
(if (<= d3 -9e+132)
t_1
(if (<= d3 -7.6e-84)
t_2
(if (<= d3 -8.4e-106)
t_0
(if (<= d3 3.5e+30)
t_2
(if (<= d3 9.5e+51) t_0 (if (<= d3 2.8e+174) t_2 t_1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -9e+132) {
tmp = t_1;
} else if (d3 <= -7.6e-84) {
tmp = t_2;
} else if (d3 <= -8.4e-106) {
tmp = t_0;
} else if (d3 <= 3.5e+30) {
tmp = t_2;
} else if (d3 <= 9.5e+51) {
tmp = t_0;
} else if (d3 <= 2.8e+174) {
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 * -d1
t_1 = d1 * -d3
t_2 = d1 * (d2 + d4)
if (d3 <= (-9d+132)) then
tmp = t_1
else if (d3 <= (-7.6d-84)) then
tmp = t_2
else if (d3 <= (-8.4d-106)) then
tmp = t_0
else if (d3 <= 3.5d+30) then
tmp = t_2
else if (d3 <= 9.5d+51) then
tmp = t_0
else if (d3 <= 2.8d+174) 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 * -d1;
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -9e+132) {
tmp = t_1;
} else if (d3 <= -7.6e-84) {
tmp = t_2;
} else if (d3 <= -8.4e-106) {
tmp = t_0;
} else if (d3 <= 3.5e+30) {
tmp = t_2;
} else if (d3 <= 9.5e+51) {
tmp = t_0;
} else if (d3 <= 2.8e+174) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = d1 * -d3 t_2 = d1 * (d2 + d4) tmp = 0 if d3 <= -9e+132: tmp = t_1 elif d3 <= -7.6e-84: tmp = t_2 elif d3 <= -8.4e-106: tmp = t_0 elif d3 <= 3.5e+30: tmp = t_2 elif d3 <= 9.5e+51: tmp = t_0 elif d3 <= 2.8e+174: tmp = t_2 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d1 * Float64(-d3)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -9e+132) tmp = t_1; elseif (d3 <= -7.6e-84) tmp = t_2; elseif (d3 <= -8.4e-106) tmp = t_0; elseif (d3 <= 3.5e+30) tmp = t_2; elseif (d3 <= 9.5e+51) tmp = t_0; elseif (d3 <= 2.8e+174) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = d1 * -d3; t_2 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -9e+132) tmp = t_1; elseif (d3 <= -7.6e-84) tmp = t_2; elseif (d3 <= -8.4e-106) tmp = t_0; elseif (d3 <= 3.5e+30) tmp = t_2; elseif (d3 <= 9.5e+51) tmp = t_0; elseif (d3 <= 2.8e+174) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -9e+132], t$95$1, If[LessEqual[d3, -7.6e-84], t$95$2, If[LessEqual[d3, -8.4e-106], t$95$0, If[LessEqual[d3, 3.5e+30], t$95$2, If[LessEqual[d3, 9.5e+51], t$95$0, If[LessEqual[d3, 2.8e+174], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -9 \cdot 10^{+132}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -7.6 \cdot 10^{-84}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq -8.4 \cdot 10^{-106}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 3.5 \cdot 10^{+30}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 9.5 \cdot 10^{+51}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 2.8 \cdot 10^{+174}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d3 < -8.99999999999999944e132 or 2.7999999999999999e174 < d3 Initial program 81.3%
associate--l+81.3%
distribute-lft-out--84.0%
distribute-rgt-out--85.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 80.1%
associate-*r*80.1%
neg-mul-180.1%
*-commutative80.1%
Simplified80.1%
if -8.99999999999999944e132 < d3 < -7.59999999999999971e-84 or -8.40000000000000013e-106 < d3 < 3.50000000000000021e30 or 9.4999999999999999e51 < d3 < 2.7999999999999999e174Initial program 90.9%
associate--l+90.9%
distribute-lft-out--91.5%
distribute-rgt-out--95.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.7%
Taylor expanded in d3 around 0 68.8%
+-commutative68.8%
Simplified68.8%
if -7.59999999999999971e-84 < d3 < -8.40000000000000013e-106 or 3.50000000000000021e30 < d3 < 9.4999999999999999e51Initial program 86.7%
associate--l+86.7%
distribute-lft-out--86.7%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 80.8%
unpow280.8%
mul-1-neg80.8%
distribute-rgt-neg-out80.8%
Simplified80.8%
Final simplification72.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d1))) (t_1 (* d1 (- d3))) (t_2 (* d1 (+ d2 d4))))
(if (<= d3 -6.8e+128)
t_1
(if (<= d3 -1.7e-69)
t_2
(if (<= d3 -1.2e-262)
t_0
(if (<= d3 1.9e-8)
t_2
(if (<= d3 1e+52) t_0 (if (<= d3 6.5e+176) 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 <= -6.8e+128) {
tmp = t_1;
} else if (d3 <= -1.7e-69) {
tmp = t_2;
} else if (d3 <= -1.2e-262) {
tmp = t_0;
} else if (d3 <= 1.9e-8) {
tmp = t_2;
} else if (d3 <= 1e+52) {
tmp = t_0;
} else if (d3 <= 6.5e+176) {
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 <= (-6.8d+128)) then
tmp = t_1
else if (d3 <= (-1.7d-69)) then
tmp = t_2
else if (d3 <= (-1.2d-262)) then
tmp = t_0
else if (d3 <= 1.9d-8) then
tmp = t_2
else if (d3 <= 1d+52) then
tmp = t_0
else if (d3 <= 6.5d+176) 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 <= -6.8e+128) {
tmp = t_1;
} else if (d3 <= -1.7e-69) {
tmp = t_2;
} else if (d3 <= -1.2e-262) {
tmp = t_0;
} else if (d3 <= 1.9e-8) {
tmp = t_2;
} else if (d3 <= 1e+52) {
tmp = t_0;
} else if (d3 <= 6.5e+176) {
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 <= -6.8e+128: tmp = t_1 elif d3 <= -1.7e-69: tmp = t_2 elif d3 <= -1.2e-262: tmp = t_0 elif d3 <= 1.9e-8: tmp = t_2 elif d3 <= 1e+52: tmp = t_0 elif d3 <= 6.5e+176: 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 <= -6.8e+128) tmp = t_1; elseif (d3 <= -1.7e-69) tmp = t_2; elseif (d3 <= -1.2e-262) tmp = t_0; elseif (d3 <= 1.9e-8) tmp = t_2; elseif (d3 <= 1e+52) tmp = t_0; elseif (d3 <= 6.5e+176) 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 <= -6.8e+128) tmp = t_1; elseif (d3 <= -1.7e-69) tmp = t_2; elseif (d3 <= -1.2e-262) tmp = t_0; elseif (d3 <= 1.9e-8) tmp = t_2; elseif (d3 <= 1e+52) tmp = t_0; elseif (d3 <= 6.5e+176) 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, -6.8e+128], t$95$1, If[LessEqual[d3, -1.7e-69], t$95$2, If[LessEqual[d3, -1.2e-262], t$95$0, If[LessEqual[d3, 1.9e-8], t$95$2, If[LessEqual[d3, 1e+52], t$95$0, If[LessEqual[d3, 6.5e+176], 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 -6.8 \cdot 10^{+128}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -1.7 \cdot 10^{-69}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq -1.2 \cdot 10^{-262}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 1.9 \cdot 10^{-8}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 10^{+52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 6.5 \cdot 10^{+176}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d3 < -6.7999999999999997e128 or 6.49999999999999949e176 < d3 Initial program 82.4%
associate--l+82.4%
distribute-lft-out--85.1%
distribute-rgt-out--86.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 81.2%
associate-*r*81.2%
neg-mul-181.2%
*-commutative81.2%
Simplified81.2%
if -6.7999999999999997e128 < d3 < -1.70000000000000004e-69 or -1.2e-262 < d3 < 1.90000000000000014e-8 or 9.9999999999999999e51 < d3 < 6.49999999999999949e176Initial program 90.6%
associate--l+90.6%
distribute-lft-out--91.4%
distribute-rgt-out--94.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 86.6%
Taylor expanded in d3 around 0 70.8%
+-commutative70.8%
Simplified70.8%
if -1.70000000000000004e-69 < d3 < -1.2e-262 or 1.90000000000000014e-8 < d3 < 9.9999999999999999e51Initial program 88.8%
associate--l+88.8%
distribute-lft-out--88.9%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 86.4%
Taylor expanded in d3 around 0 77.9%
Final simplification75.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (- d4 d1))))
(if (<= d2 -6.5e+52)
t_0
(if (<= d2 -4.2e+16)
t_1
(if (<= d2 -1.1e-10)
t_0
(if (or (<= d2 -4.8e-116) (not (<= d2 -4.2e-196)))
(* d1 (- d4 d3))
t_1))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 - d1);
double tmp;
if (d2 <= -6.5e+52) {
tmp = t_0;
} else if (d2 <= -4.2e+16) {
tmp = t_1;
} else if (d2 <= -1.1e-10) {
tmp = t_0;
} else if ((d2 <= -4.8e-116) || !(d2 <= -4.2e-196)) {
tmp = d1 * (d4 - d3);
} 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) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * (d4 - d1)
if (d2 <= (-6.5d+52)) then
tmp = t_0
else if (d2 <= (-4.2d+16)) then
tmp = t_1
else if (d2 <= (-1.1d-10)) then
tmp = t_0
else if ((d2 <= (-4.8d-116)) .or. (.not. (d2 <= (-4.2d-196)))) then
tmp = d1 * (d4 - d3)
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 * (d2 - d3);
double t_1 = d1 * (d4 - d1);
double tmp;
if (d2 <= -6.5e+52) {
tmp = t_0;
} else if (d2 <= -4.2e+16) {
tmp = t_1;
} else if (d2 <= -1.1e-10) {
tmp = t_0;
} else if ((d2 <= -4.8e-116) || !(d2 <= -4.2e-196)) {
tmp = d1 * (d4 - d3);
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d4 - d1) tmp = 0 if d2 <= -6.5e+52: tmp = t_0 elif d2 <= -4.2e+16: tmp = t_1 elif d2 <= -1.1e-10: tmp = t_0 elif (d2 <= -4.8e-116) or not (d2 <= -4.2e-196): tmp = d1 * (d4 - d3) else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d4 - d1)) tmp = 0.0 if (d2 <= -6.5e+52) tmp = t_0; elseif (d2 <= -4.2e+16) tmp = t_1; elseif (d2 <= -1.1e-10) tmp = t_0; elseif ((d2 <= -4.8e-116) || !(d2 <= -4.2e-196)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d4 - d1); tmp = 0.0; if (d2 <= -6.5e+52) tmp = t_0; elseif (d2 <= -4.2e+16) tmp = t_1; elseif (d2 <= -1.1e-10) tmp = t_0; elseif ((d2 <= -4.8e-116) || ~((d2 <= -4.2e-196))) tmp = d1 * (d4 - d3); else tmp = t_1; 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[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -6.5e+52], t$95$0, If[LessEqual[d2, -4.2e+16], t$95$1, If[LessEqual[d2, -1.1e-10], t$95$0, If[Or[LessEqual[d2, -4.8e-116], N[Not[LessEqual[d2, -4.2e-196]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d4 - d1\right)\\
\mathbf{if}\;d2 \leq -6.5 \cdot 10^{+52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -4.2 \cdot 10^{+16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -1.1 \cdot 10^{-10}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -4.8 \cdot 10^{-116} \lor \neg \left(d2 \leq -4.2 \cdot 10^{-196}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d2 < -6.49999999999999996e52 or -4.2e16 < d2 < -1.09999999999999995e-10Initial program 87.0%
associate--l+87.0%
distribute-lft-out--92.6%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.6%
Taylor expanded in d1 around 0 74.5%
if -6.49999999999999996e52 < d2 < -4.2e16 or -4.79999999999999986e-116 < d2 < -4.19999999999999977e-196Initial program 79.9%
associate--l+79.9%
distribute-lft-out--79.9%
distribute-rgt-out--83.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 95.0%
Taylor expanded in d3 around 0 72.0%
if -1.09999999999999995e-10 < d2 < -4.79999999999999986e-116 or -4.19999999999999977e-196 < d2 Initial program 89.2%
associate--l+89.2%
distribute-lft-out--89.2%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.6%
Taylor expanded in d1 around 0 66.0%
Final simplification68.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (- d4 d1))))
(if (<= d3 -1.26e-48)
t_0
(if (<= d3 -2.1e-257)
t_1
(if (<= d3 1.88e-6) (* d1 (+ d2 d4)) (if (<= d3 1e+52) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 - d1);
double tmp;
if (d3 <= -1.26e-48) {
tmp = t_0;
} else if (d3 <= -2.1e-257) {
tmp = t_1;
} else if (d3 <= 1.88e-6) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 1e+52) {
tmp = t_1;
} 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 * (d4 - d1)
if (d3 <= (-1.26d-48)) then
tmp = t_0
else if (d3 <= (-2.1d-257)) then
tmp = t_1
else if (d3 <= 1.88d-6) then
tmp = d1 * (d2 + d4)
else if (d3 <= 1d+52) then
tmp = t_1
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 * (d4 - d1);
double tmp;
if (d3 <= -1.26e-48) {
tmp = t_0;
} else if (d3 <= -2.1e-257) {
tmp = t_1;
} else if (d3 <= 1.88e-6) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 1e+52) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d4 - d1) tmp = 0 if d3 <= -1.26e-48: tmp = t_0 elif d3 <= -2.1e-257: tmp = t_1 elif d3 <= 1.88e-6: tmp = d1 * (d2 + d4) elif d3 <= 1e+52: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d4 - d1)) tmp = 0.0 if (d3 <= -1.26e-48) tmp = t_0; elseif (d3 <= -2.1e-257) tmp = t_1; elseif (d3 <= 1.88e-6) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d3 <= 1e+52) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d4 - d1); tmp = 0.0; if (d3 <= -1.26e-48) tmp = t_0; elseif (d3 <= -2.1e-257) tmp = t_1; elseif (d3 <= 1.88e-6) tmp = d1 * (d2 + d4); elseif (d3 <= 1e+52) tmp = t_1; 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[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.26e-48], t$95$0, If[LessEqual[d3, -2.1e-257], t$95$1, If[LessEqual[d3, 1.88e-6], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1e+52], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d4 - d1\right)\\
\mathbf{if}\;d3 \leq -1.26 \cdot 10^{-48}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -2.1 \cdot 10^{-257}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 1.88 \cdot 10^{-6}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d3 \leq 10^{+52}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -1.2599999999999999e-48 or 9.9999999999999999e51 < d3 Initial program 85.6%
associate--l+85.6%
distribute-lft-out--87.8%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.7%
Taylor expanded in d1 around 0 77.6%
if -1.2599999999999999e-48 < d3 < -2.1000000000000001e-257 or 1.88e-6 < d3 < 9.9999999999999999e51Initial 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 87.3%
Taylor expanded in d3 around 0 79.4%
if -2.1000000000000001e-257 < d3 < 1.88e-6Initial program 91.4%
associate--l+91.4%
distribute-lft-out--91.4%
distribute-rgt-out--96.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 83.3%
Taylor expanded in d3 around 0 80.8%
+-commutative80.8%
Simplified80.8%
Final simplification78.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.9e+80) (* d1 (- d2 d3)) (if (<= d2 -2.3e-215) (* (+ d1 d3) (- d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.9e+80) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -2.3e-215) {
tmp = (d1 + d3) * -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 (d2 <= (-1.9d+80)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-2.3d-215)) then
tmp = (d1 + d3) * -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 (d2 <= -1.9e+80) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -2.3e-215) {
tmp = (d1 + d3) * -d1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.9e+80: tmp = d1 * (d2 - d3) elif d2 <= -2.3e-215: tmp = (d1 + d3) * -d1 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.9e+80) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -2.3e-215) tmp = Float64(Float64(d1 + d3) * Float64(-d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.9e+80) tmp = d1 * (d2 - d3); elseif (d2 <= -2.3e-215) tmp = (d1 + d3) * -d1; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.9e+80], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -2.3e-215], N[(N[(d1 + d3), $MachinePrecision] * (-d1)), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.9 \cdot 10^{+80}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -2.3 \cdot 10^{-215}:\\
\;\;\;\;\left(d1 + d3\right) \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -1.89999999999999999e80Initial program 84.2%
associate--l+84.2%
distribute-lft-out--92.1%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.4%
Taylor expanded in d1 around 0 78.8%
if -1.89999999999999999e80 < d2 < -2.2999999999999999e-215Initial program 82.8%
associate--l+82.8%
distribute-lft-out--82.8%
distribute-rgt-out--85.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 77.4%
Taylor expanded in d2 around 0 69.5%
mul-1-neg69.5%
*-commutative69.5%
distribute-rgt-neg-out69.5%
distribute-neg-in69.5%
unsub-neg69.5%
Simplified69.5%
if -2.2999999999999999e-215 < d2 Initial program 90.8%
associate--l+90.8%
distribute-lft-out--90.9%
distribute-rgt-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 84.1%
Taylor expanded in d1 around 0 64.8%
Final simplification68.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -3.5e-99)
(* d1 d2)
(if (<= d4 1.25e-34)
(* d1 (- d1))
(if (<= d4 9e+105) (* d1 d2) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -3.5e-99) {
tmp = d1 * d2;
} else if (d4 <= 1.25e-34) {
tmp = d1 * -d1;
} else if (d4 <= 9e+105) {
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 <= (-3.5d-99)) then
tmp = d1 * d2
else if (d4 <= 1.25d-34) then
tmp = d1 * -d1
else if (d4 <= 9d+105) 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 <= -3.5e-99) {
tmp = d1 * d2;
} else if (d4 <= 1.25e-34) {
tmp = d1 * -d1;
} else if (d4 <= 9e+105) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -3.5e-99: tmp = d1 * d2 elif d4 <= 1.25e-34: tmp = d1 * -d1 elif d4 <= 9e+105: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -3.5e-99) tmp = Float64(d1 * d2); elseif (d4 <= 1.25e-34) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 9e+105) 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 <= -3.5e-99) tmp = d1 * d2; elseif (d4 <= 1.25e-34) tmp = d1 * -d1; elseif (d4 <= 9e+105) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -3.5e-99], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.25e-34], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 9e+105], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -3.5 \cdot 10^{-99}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.25 \cdot 10^{-34}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 9 \cdot 10^{+105}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -3.4999999999999999e-99 or 1.2500000000000001e-34 < d4 < 9.0000000000000002e105Initial program 86.3%
associate--l+86.3%
distribute-lft-out--87.3%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 27.0%
if -3.4999999999999999e-99 < d4 < 1.2500000000000001e-34Initial program 92.2%
associate--l+92.2%
distribute-lft-out--94.2%
distribute-rgt-out--94.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 43.0%
unpow243.0%
mul-1-neg43.0%
distribute-rgt-neg-out43.0%
Simplified43.0%
if 9.0000000000000002e105 < d4 Initial program 82.0%
associate--l+82.0%
distribute-lft-out--82.0%
distribute-rgt-out--88.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 68.6%
Final simplification41.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -5.6e+81) (* d1 (- d2 d3)) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.6e+81) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - (d1 + 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 <= (-5.6d+81)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - (d1 + d3))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.6e+81) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -5.6e+81: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -5.6e+81) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -5.6e+81) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -5.6e+81], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -5.6 \cdot 10^{+81}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -5.5999999999999999e81Initial program 84.2%
associate--l+84.2%
distribute-lft-out--92.1%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.4%
Taylor expanded in d1 around 0 78.8%
if -5.5999999999999999e81 < d2 Initial program 88.5%
associate--l+88.5%
distribute-lft-out--88.5%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 86.3%
Final simplification85.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.35e-11) (* d1 (- (+ d2 d4) d3)) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.35e-11) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * (d4 - (d1 + 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 <= (-1.35d-11)) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * (d4 - (d1 + d3))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.35e-11) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.35e-11: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.35e-11) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.35e-11) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.35e-11], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.35 \cdot 10^{-11}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -1.35000000000000002e-11Initial program 86.4%
associate--l+86.4%
distribute-lft-out--91.5%
distribute-rgt-out--93.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 93.6%
if -1.35000000000000002e-11 < d2 Initial program 88.3%
associate--l+88.3%
distribute-lft-out--88.3%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 87.1%
Final simplification88.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.6e+66) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.6e+66) {
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 <= 1.6d+66) 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 <= 1.6e+66) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.6e+66: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.6e+66) 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 <= 1.6e+66) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.6e+66], 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 1.6 \cdot 10^{+66}:\\
\;\;\;\;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 < 1.6e66Initial program 89.5%
associate--l+89.5%
distribute-lft-out--91.0%
distribute-rgt-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.4%
if 1.6e66 < d4 Initial program 81.8%
associate--l+81.8%
distribute-lft-out--81.8%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 95.3%
Final simplification86.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 7.2e+105) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 7.2e+105) {
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 <= 7.2d+105) 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 <= 7.2e+105) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 7.2e+105: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 7.2e+105) 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 <= 7.2e+105) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 7.2e+105], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 7.2 \cdot 10^{+105}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 7.1999999999999998e105Initial program 89.3%
associate--l+89.3%
distribute-lft-out--90.7%
distribute-rgt-out--93.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.1%
if 7.1999999999999998e105 < d4 Initial program 82.0%
associate--l+82.0%
distribute-lft-out--82.0%
distribute-rgt-out--88.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 68.6%
Final simplification37.6%
(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 87.8%
associate--l+87.8%
distribute-lft-out--89.0%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 30.6%
Final simplification30.6%
(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 2023200
(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)))