
(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 14 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--91.0%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (- d1))) (t_2 (* d1 (+ d2 d4))))
(if (<= d1 -1.6e+133)
t_1
(if (<= d1 -6.2e-75)
t_2
(if (<= d1 -2.9e-122)
t_0
(if (<= d1 -1.4e-180)
t_2
(if (<= d1 -2.6e-282) t_0 (if (<= d1 1.75e+145) t_2 t_1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * -d1;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d1 <= -1.6e+133) {
tmp = t_1;
} else if (d1 <= -6.2e-75) {
tmp = t_2;
} else if (d1 <= -2.9e-122) {
tmp = t_0;
} else if (d1 <= -1.4e-180) {
tmp = t_2;
} else if (d1 <= -2.6e-282) {
tmp = t_0;
} else if (d1 <= 1.75e+145) {
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 * -d3
t_1 = d1 * -d1
t_2 = d1 * (d2 + d4)
if (d1 <= (-1.6d+133)) then
tmp = t_1
else if (d1 <= (-6.2d-75)) then
tmp = t_2
else if (d1 <= (-2.9d-122)) then
tmp = t_0
else if (d1 <= (-1.4d-180)) then
tmp = t_2
else if (d1 <= (-2.6d-282)) then
tmp = t_0
else if (d1 <= 1.75d+145) 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 * -d3;
double t_1 = d1 * -d1;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d1 <= -1.6e+133) {
tmp = t_1;
} else if (d1 <= -6.2e-75) {
tmp = t_2;
} else if (d1 <= -2.9e-122) {
tmp = t_0;
} else if (d1 <= -1.4e-180) {
tmp = t_2;
} else if (d1 <= -2.6e-282) {
tmp = t_0;
} else if (d1 <= 1.75e+145) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * -d1 t_2 = d1 * (d2 + d4) tmp = 0 if d1 <= -1.6e+133: tmp = t_1 elif d1 <= -6.2e-75: tmp = t_2 elif d1 <= -2.9e-122: tmp = t_0 elif d1 <= -1.4e-180: tmp = t_2 elif d1 <= -2.6e-282: tmp = t_0 elif d1 <= 1.75e+145: tmp = t_2 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) t_1 = Float64(d1 * Float64(-d1)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d1 <= -1.6e+133) tmp = t_1; elseif (d1 <= -6.2e-75) tmp = t_2; elseif (d1 <= -2.9e-122) tmp = t_0; elseif (d1 <= -1.4e-180) tmp = t_2; elseif (d1 <= -2.6e-282) tmp = t_0; elseif (d1 <= 1.75e+145) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; t_1 = d1 * -d1; t_2 = d1 * (d2 + d4); tmp = 0.0; if (d1 <= -1.6e+133) tmp = t_1; elseif (d1 <= -6.2e-75) tmp = t_2; elseif (d1 <= -2.9e-122) tmp = t_0; elseif (d1 <= -1.4e-180) tmp = t_2; elseif (d1 <= -2.6e-282) tmp = t_0; elseif (d1 <= 1.75e+145) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -1.6e+133], t$95$1, If[LessEqual[d1, -6.2e-75], t$95$2, If[LessEqual[d1, -2.9e-122], t$95$0, If[LessEqual[d1, -1.4e-180], t$95$2, If[LessEqual[d1, -2.6e-282], t$95$0, If[LessEqual[d1, 1.75e+145], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(-d1\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d1 \leq -1.6 \cdot 10^{+133}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d1 \leq -6.2 \cdot 10^{-75}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d1 \leq -2.9 \cdot 10^{-122}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq -1.4 \cdot 10^{-180}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d1 \leq -2.6 \cdot 10^{-282}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq 1.75 \cdot 10^{+145}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d1 < -1.59999999999999999e133 or 1.7500000000000001e145 < d1 Initial program 67.6%
associate--l+67.6%
distribute-lft-out--70.6%
distribute-rgt-out--79.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 84.1%
neg-mul-184.1%
unpow284.1%
distribute-rgt-neg-in84.1%
Simplified84.1%
if -1.59999999999999999e133 < d1 < -6.20000000000000013e-75 or -2.9000000000000002e-122 < d1 < -1.39999999999999999e-180 or -2.60000000000000012e-282 < d1 < 1.7500000000000001e145Initial program 96.7%
associate--l+96.7%
distribute-lft-out--98.0%
distribute-rgt-out--98.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.7%
Taylor expanded in d1 around 0 65.5%
if -6.20000000000000013e-75 < d1 < -2.9000000000000002e-122 or -1.39999999999999999e-180 < d1 < -2.60000000000000012e-282Initial 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 d3 around inf 69.9%
mul-1-neg69.9%
*-commutative69.9%
distribute-rgt-neg-in69.9%
Simplified69.9%
Final simplification71.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (- d4 d1))) (t_2 (* d1 (+ d2 d4))))
(if (<= d1 -6e+26)
t_1
(if (<= d1 -3.4e-72)
t_2
(if (<= d1 -7.6e-122)
t_0
(if (<= d1 -1.5e-180)
t_2
(if (<= d1 -4.4e-277) t_0 (if (<= d1 3.4e+105) t_2 t_1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * (d4 - d1);
double t_2 = d1 * (d2 + d4);
double tmp;
if (d1 <= -6e+26) {
tmp = t_1;
} else if (d1 <= -3.4e-72) {
tmp = t_2;
} else if (d1 <= -7.6e-122) {
tmp = t_0;
} else if (d1 <= -1.5e-180) {
tmp = t_2;
} else if (d1 <= -4.4e-277) {
tmp = t_0;
} else if (d1 <= 3.4e+105) {
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 * -d3
t_1 = d1 * (d4 - d1)
t_2 = d1 * (d2 + d4)
if (d1 <= (-6d+26)) then
tmp = t_1
else if (d1 <= (-3.4d-72)) then
tmp = t_2
else if (d1 <= (-7.6d-122)) then
tmp = t_0
else if (d1 <= (-1.5d-180)) then
tmp = t_2
else if (d1 <= (-4.4d-277)) then
tmp = t_0
else if (d1 <= 3.4d+105) 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 * -d3;
double t_1 = d1 * (d4 - d1);
double t_2 = d1 * (d2 + d4);
double tmp;
if (d1 <= -6e+26) {
tmp = t_1;
} else if (d1 <= -3.4e-72) {
tmp = t_2;
} else if (d1 <= -7.6e-122) {
tmp = t_0;
} else if (d1 <= -1.5e-180) {
tmp = t_2;
} else if (d1 <= -4.4e-277) {
tmp = t_0;
} else if (d1 <= 3.4e+105) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * (d4 - d1) t_2 = d1 * (d2 + d4) tmp = 0 if d1 <= -6e+26: tmp = t_1 elif d1 <= -3.4e-72: tmp = t_2 elif d1 <= -7.6e-122: tmp = t_0 elif d1 <= -1.5e-180: tmp = t_2 elif d1 <= -4.4e-277: tmp = t_0 elif d1 <= 3.4e+105: tmp = t_2 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) t_1 = Float64(d1 * Float64(d4 - d1)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d1 <= -6e+26) tmp = t_1; elseif (d1 <= -3.4e-72) tmp = t_2; elseif (d1 <= -7.6e-122) tmp = t_0; elseif (d1 <= -1.5e-180) tmp = t_2; elseif (d1 <= -4.4e-277) tmp = t_0; elseif (d1 <= 3.4e+105) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; t_1 = d1 * (d4 - d1); t_2 = d1 * (d2 + d4); tmp = 0.0; if (d1 <= -6e+26) tmp = t_1; elseif (d1 <= -3.4e-72) tmp = t_2; elseif (d1 <= -7.6e-122) tmp = t_0; elseif (d1 <= -1.5e-180) tmp = t_2; elseif (d1 <= -4.4e-277) tmp = t_0; elseif (d1 <= 3.4e+105) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -6e+26], t$95$1, If[LessEqual[d1, -3.4e-72], t$95$2, If[LessEqual[d1, -7.6e-122], t$95$0, If[LessEqual[d1, -1.5e-180], t$95$2, If[LessEqual[d1, -4.4e-277], t$95$0, If[LessEqual[d1, 3.4e+105], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d4 - d1\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d1 \leq -6 \cdot 10^{+26}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d1 \leq -3.4 \cdot 10^{-72}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d1 \leq -7.6 \cdot 10^{-122}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq -1.5 \cdot 10^{-180}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d1 \leq -4.4 \cdot 10^{-277}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq 3.4 \cdot 10^{+105}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d1 < -5.99999999999999994e26 or 3.3999999999999999e105 < d1 Initial program 73.7%
associate--l+73.7%
distribute-lft-out--77.8%
distribute-rgt-out--83.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.4%
Taylor expanded in d2 around 0 83.1%
if -5.99999999999999994e26 < d1 < -3.3999999999999998e-72 or -7.6000000000000002e-122 < d1 < -1.5e-180 or -4.39999999999999991e-277 < d1 < 3.3999999999999999e105Initial program 99.1%
associate--l+99.1%
distribute-lft-out--99.1%
distribute-rgt-out--99.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.8%
Taylor expanded in d1 around 0 70.6%
if -3.3999999999999998e-72 < d1 < -7.6000000000000002e-122 or -1.5e-180 < d1 < -4.39999999999999991e-277Initial 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 d3 around inf 69.9%
mul-1-neg69.9%
*-commutative69.9%
distribute-rgt-neg-in69.9%
Simplified69.9%
Final simplification75.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- (- d1) d3))))
(if (<= d4 -3.9e-297)
t_0
(if (<= d4 4.6e-51)
t_1
(if (<= d4 6.5e-17)
t_0
(if (<= d4 1.25e+75)
t_1
(if (<= d4 1.35e+140) (* d1 (- d4 d3)) (* d1 (+ d2 d4)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (-d1 - d3);
double tmp;
if (d4 <= -3.9e-297) {
tmp = t_0;
} else if (d4 <= 4.6e-51) {
tmp = t_1;
} else if (d4 <= 6.5e-17) {
tmp = t_0;
} else if (d4 <= 1.25e+75) {
tmp = t_1;
} else if (d4 <= 1.35e+140) {
tmp = d1 * (d4 - 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (-d1 - d3)
if (d4 <= (-3.9d-297)) then
tmp = t_0
else if (d4 <= 4.6d-51) then
tmp = t_1
else if (d4 <= 6.5d-17) then
tmp = t_0
else if (d4 <= 1.25d+75) then
tmp = t_1
else if (d4 <= 1.35d+140) then
tmp = d1 * (d4 - 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 t_0 = d1 * (d2 - d1);
double t_1 = d1 * (-d1 - d3);
double tmp;
if (d4 <= -3.9e-297) {
tmp = t_0;
} else if (d4 <= 4.6e-51) {
tmp = t_1;
} else if (d4 <= 6.5e-17) {
tmp = t_0;
} else if (d4 <= 1.25e+75) {
tmp = t_1;
} else if (d4 <= 1.35e+140) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (-d1 - d3) tmp = 0 if d4 <= -3.9e-297: tmp = t_0 elif d4 <= 4.6e-51: tmp = t_1 elif d4 <= 6.5e-17: tmp = t_0 elif d4 <= 1.25e+75: tmp = t_1 elif d4 <= 1.35e+140: tmp = d1 * (d4 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(Float64(-d1) - d3)) tmp = 0.0 if (d4 <= -3.9e-297) tmp = t_0; elseif (d4 <= 4.6e-51) tmp = t_1; elseif (d4 <= 6.5e-17) tmp = t_0; elseif (d4 <= 1.25e+75) tmp = t_1; elseif (d4 <= 1.35e+140) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (-d1 - d3); tmp = 0.0; if (d4 <= -3.9e-297) tmp = t_0; elseif (d4 <= 4.6e-51) tmp = t_1; elseif (d4 <= 6.5e-17) tmp = t_0; elseif (d4 <= 1.25e+75) tmp = t_1; elseif (d4 <= 1.35e+140) tmp = d1 * (d4 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, -3.9e-297], t$95$0, If[LessEqual[d4, 4.6e-51], t$95$1, If[LessEqual[d4, 6.5e-17], t$95$0, If[LessEqual[d4, 1.25e+75], t$95$1, If[LessEqual[d4, 1.35e+140], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{if}\;d4 \leq -3.9 \cdot 10^{-297}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 4.6 \cdot 10^{-51}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 6.5 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.25 \cdot 10^{+75}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 1.35 \cdot 10^{+140}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -3.9000000000000001e-297 or 4.60000000000000004e-51 < d4 < 6.4999999999999996e-17Initial program 85.7%
associate--l+85.7%
distribute-lft-out--87.9%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 77.5%
Taylor expanded in d3 around 0 56.8%
if -3.9000000000000001e-297 < d4 < 4.60000000000000004e-51 or 6.4999999999999996e-17 < d4 < 1.2500000000000001e75Initial program 96.0%
associate--l+96.0%
distribute-lft-out--97.4%
distribute-rgt-out--97.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 98.8%
Taylor expanded in d2 around 0 74.1%
mul-1-neg74.1%
distribute-rgt-neg-in74.1%
Simplified74.1%
if 1.2500000000000001e75 < d4 < 1.35000000000000009e140Initial program 99.8%
associate--l+99.8%
distribute-lft-out--99.8%
distribute-rgt-out--99.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 93.2%
Taylor expanded in d2 around 0 83.6%
if 1.35000000000000009e140 < d4 Initial program 84.3%
associate--l+84.3%
distribute-lft-out--84.3%
distribute-rgt-out--90.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 86.6%
Taylor expanded in d1 around 0 83.5%
Final simplification66.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))))
(if (<= d4 -1.3e-300)
(* d1 d2)
(if (<= d4 1e-247)
t_0
(if (<= d4 1.06e-231)
(* d1 d2)
(if (<= d4 1600000000.0)
(* d1 (- d1))
(if (<= d4 4e+79) t_0 (* d1 d4))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d4 <= -1.3e-300) {
tmp = d1 * d2;
} else if (d4 <= 1e-247) {
tmp = t_0;
} else if (d4 <= 1.06e-231) {
tmp = d1 * d2;
} else if (d4 <= 1600000000.0) {
tmp = d1 * -d1;
} else if (d4 <= 4e+79) {
tmp = t_0;
} 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) :: tmp
t_0 = d1 * -d3
if (d4 <= (-1.3d-300)) then
tmp = d1 * d2
else if (d4 <= 1d-247) then
tmp = t_0
else if (d4 <= 1.06d-231) then
tmp = d1 * d2
else if (d4 <= 1600000000.0d0) then
tmp = d1 * -d1
else if (d4 <= 4d+79) then
tmp = t_0
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 * -d3;
double tmp;
if (d4 <= -1.3e-300) {
tmp = d1 * d2;
} else if (d4 <= 1e-247) {
tmp = t_0;
} else if (d4 <= 1.06e-231) {
tmp = d1 * d2;
} else if (d4 <= 1600000000.0) {
tmp = d1 * -d1;
} else if (d4 <= 4e+79) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 tmp = 0 if d4 <= -1.3e-300: tmp = d1 * d2 elif d4 <= 1e-247: tmp = t_0 elif d4 <= 1.06e-231: tmp = d1 * d2 elif d4 <= 1600000000.0: tmp = d1 * -d1 elif d4 <= 4e+79: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d4 <= -1.3e-300) tmp = Float64(d1 * d2); elseif (d4 <= 1e-247) tmp = t_0; elseif (d4 <= 1.06e-231) tmp = Float64(d1 * d2); elseif (d4 <= 1600000000.0) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 4e+79) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; tmp = 0.0; if (d4 <= -1.3e-300) tmp = d1 * d2; elseif (d4 <= 1e-247) tmp = t_0; elseif (d4 <= 1.06e-231) tmp = d1 * d2; elseif (d4 <= 1600000000.0) tmp = d1 * -d1; elseif (d4 <= 4e+79) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d4, -1.3e-300], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1e-247], t$95$0, If[LessEqual[d4, 1.06e-231], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1600000000.0], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 4e+79], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq -1.3 \cdot 10^{-300}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 10^{-247}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.06 \cdot 10^{-231}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1600000000:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 4 \cdot 10^{+79}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -1.29999999999999998e-300 or 1e-247 < d4 < 1.0600000000000001e-231Initial program 86.7%
associate--l+86.7%
distribute-lft-out--89.0%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 36.1%
if -1.29999999999999998e-300 < d4 < 1e-247 or 1.6e9 < d4 < 3.99999999999999987e79Initial program 95.8%
associate--l+95.8%
distribute-lft-out--95.8%
distribute-rgt-out--95.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 37.2%
mul-1-neg37.2%
*-commutative37.2%
distribute-rgt-neg-in37.2%
Simplified37.2%
if 1.0600000000000001e-231 < d4 < 1.6e9Initial program 93.0%
associate--l+93.0%
distribute-lft-out--94.7%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 49.0%
neg-mul-149.0%
unpow249.0%
distribute-rgt-neg-in49.0%
Simplified49.0%
if 3.99999999999999987e79 < d4 Initial program 89.3%
associate--l+89.3%
distribute-lft-out--89.2%
distribute-rgt-out--93.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 59.9%
Final simplification43.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d1 -3.2e+21)
(* d1 (- d2 d1))
(if (<= d1 6.5e-256)
(* d1 (- d2 d3))
(if (<= d1 1.8e+105) (* d1 (+ d2 d4)) (* d1 (- d4 d1))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d1 <= -3.2e+21) {
tmp = d1 * (d2 - d1);
} else if (d1 <= 6.5e-256) {
tmp = d1 * (d2 - d3);
} else if (d1 <= 1.8e+105) {
tmp = d1 * (d2 + d4);
} else {
tmp = d1 * (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 (d1 <= (-3.2d+21)) then
tmp = d1 * (d2 - d1)
else if (d1 <= 6.5d-256) then
tmp = d1 * (d2 - d3)
else if (d1 <= 1.8d+105) then
tmp = d1 * (d2 + d4)
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d1 <= -3.2e+21) {
tmp = d1 * (d2 - d1);
} else if (d1 <= 6.5e-256) {
tmp = d1 * (d2 - d3);
} else if (d1 <= 1.8e+105) {
tmp = d1 * (d2 + d4);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d1 <= -3.2e+21: tmp = d1 * (d2 - d1) elif d1 <= 6.5e-256: tmp = d1 * (d2 - d3) elif d1 <= 1.8e+105: tmp = d1 * (d2 + d4) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d1 <= -3.2e+21) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d1 <= 6.5e-256) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d1 <= 1.8e+105) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d1 <= -3.2e+21) tmp = d1 * (d2 - d1); elseif (d1 <= 6.5e-256) tmp = d1 * (d2 - d3); elseif (d1 <= 1.8e+105) tmp = d1 * (d2 + d4); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d1, -3.2e+21], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 6.5e-256], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 1.8e+105], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -3.2 \cdot 10^{+21}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d1 \leq 6.5 \cdot 10^{-256}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d1 \leq 1.8 \cdot 10^{+105}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d1 < -3.2e21Initial program 75.4%
associate--l+75.4%
distribute-lft-out--78.7%
distribute-rgt-out--85.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 83.7%
Taylor expanded in d3 around 0 77.9%
if -3.2e21 < d1 < 6.50000000000000052e-256Initial program 99.9%
associate--l+99.9%
distribute-lft-out--99.9%
distribute-rgt-out--99.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 76.3%
Taylor expanded in d1 around 0 73.6%
if 6.50000000000000052e-256 < d1 < 1.7999999999999999e105Initial program 98.7%
associate--l+98.7%
distribute-lft-out--98.7%
distribute-rgt-out--98.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 75.5%
Taylor expanded in d1 around 0 71.1%
if 1.7999999999999999e105 < d1 Initial program 73.2%
associate--l+73.2%
distribute-lft-out--78.0%
distribute-rgt-out--82.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 90.3%
Taylor expanded in d2 around 0 86.7%
Final simplification75.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -8.4e+21) (not (<= d1 5e+74))) (* d1 (- (+ d2 d4) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -8.4e+21) || !(d1 <= 5e+74)) {
tmp = d1 * ((d2 + d4) - d1);
} 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 <= (-8.4d+21)) .or. (.not. (d1 <= 5d+74))) then
tmp = d1 * ((d2 + d4) - d1)
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 <= -8.4e+21) || !(d1 <= 5e+74)) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -8.4e+21) or not (d1 <= 5e+74): tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -8.4e+21) || !(d1 <= 5e+74)) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); 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 <= -8.4e+21) || ~((d1 <= 5e+74))) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -8.4e+21], N[Not[LessEqual[d1, 5e+74]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -8.4 \cdot 10^{+21} \lor \neg \left(d1 \leq 5 \cdot 10^{+74}\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -8.4e21 or 4.99999999999999963e74 < d1 Initial program 76.3%
associate--l+76.3%
distribute-lft-out--80.0%
distribute-rgt-out--85.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.8%
if -8.4e21 < d1 < 4.99999999999999963e74Initial program 99.3%
associate--l+99.3%
distribute-lft-out--99.3%
distribute-rgt-out--99.3%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 97.1%
Final simplification95.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -9.2e+111) (* d1 (- d2 d3)) (if (<= d3 8.2e+120) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -9.2e+111) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 8.2e+120) {
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 <= (-9.2d+111)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 8.2d+120) 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 <= -9.2e+111) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 8.2e+120) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -9.2e+111: tmp = d1 * (d2 - d3) elif d3 <= 8.2e+120: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -9.2e+111) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 8.2e+120) 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 <= -9.2e+111) tmp = d1 * (d2 - d3); elseif (d3 <= 8.2e+120) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -9.2e+111], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 8.2e+120], 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 -9.2 \cdot 10^{+111}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 8.2 \cdot 10^{+120}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -9.20000000000000008e111Initial program 88.3%
associate--l+88.3%
distribute-lft-out--90.6%
distribute-rgt-out--90.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 88.5%
Taylor expanded in d1 around 0 88.5%
if -9.20000000000000008e111 < d3 < 8.2e120Initial program 92.2%
associate--l+92.2%
distribute-lft-out--93.3%
distribute-rgt-out--96.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.1%
if 8.2e120 < d3 Initial program 75.0%
associate--l+75.0%
distribute-lft-out--78.1%
distribute-rgt-out--81.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 90.6%
Taylor expanded in d2 around 0 84.4%
Final simplification90.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 5.8e+41) (* d1 (- d2 d1)) (if (<= d4 9e+132) (* d1 (- d4 d1)) (* d1 (+ d2 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5.8e+41) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 9e+132) {
tmp = d1 * (d4 - d1);
} 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 <= 5.8d+41) then
tmp = d1 * (d2 - d1)
else if (d4 <= 9d+132) then
tmp = d1 * (d4 - d1)
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 <= 5.8e+41) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 9e+132) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 5.8e+41: tmp = d1 * (d2 - d1) elif d4 <= 9e+132: tmp = d1 * (d4 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 5.8e+41) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 9e+132) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 5.8e+41) tmp = d1 * (d2 - d1); elseif (d4 <= 9e+132) tmp = d1 * (d4 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 5.8e+41], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 9e+132], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 5.8 \cdot 10^{+41}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 9 \cdot 10^{+132}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 5.79999999999999977e41Initial program 89.8%
associate--l+89.8%
distribute-lft-out--91.7%
distribute-rgt-out--93.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.0%
Taylor expanded in d3 around 0 60.9%
if 5.79999999999999977e41 < d4 < 8.99999999999999944e132Initial program 93.9%
associate--l+93.9%
distribute-lft-out--93.9%
distribute-rgt-out--93.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 76.4%
Taylor expanded in d2 around 0 61.8%
if 8.99999999999999944e132 < d4 Initial program 84.8%
associate--l+84.8%
distribute-lft-out--84.8%
distribute-rgt-out--90.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 84.0%
Taylor expanded in d1 around 0 81.0%
Final simplification63.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.58e+41) (* d1 (- d2 d1)) (if (<= d4 7.5e+140) (* d1 (- d4 d3)) (* d1 (+ d2 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.58e+41) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 7.5e+140) {
tmp = d1 * (d4 - 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 <= 1.58d+41) then
tmp = d1 * (d2 - d1)
else if (d4 <= 7.5d+140) then
tmp = d1 * (d4 - 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 <= 1.58e+41) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 7.5e+140) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.58e+41: tmp = d1 * (d2 - d1) elif d4 <= 7.5e+140: tmp = d1 * (d4 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.58e+41) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 7.5e+140) tmp = Float64(d1 * Float64(d4 - 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 <= 1.58e+41) tmp = d1 * (d2 - d1); elseif (d4 <= 7.5e+140) tmp = d1 * (d4 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.58e+41], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 7.5e+140], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.58 \cdot 10^{+41}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 7.5 \cdot 10^{+140}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 1.5799999999999999e41Initial program 89.8%
associate--l+89.8%
distribute-lft-out--91.7%
distribute-rgt-out--93.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.0%
Taylor expanded in d3 around 0 60.9%
if 1.5799999999999999e41 < d4 < 7.4999999999999997e140Initial program 94.3%
associate--l+94.3%
distribute-lft-out--94.3%
distribute-rgt-out--94.3%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 83.3%
Taylor expanded in d2 around 0 69.9%
if 7.4999999999999997e140 < d4 Initial program 84.3%
associate--l+84.3%
distribute-lft-out--84.3%
distribute-rgt-out--90.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 86.6%
Taylor expanded in d1 around 0 83.5%
Final simplification64.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 5.8e+75) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5.8e+75) {
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 <= 5.8d+75) 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 <= 5.8e+75) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 5.8e+75: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 5.8e+75) 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 <= 5.8e+75) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 5.8e+75], 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 5.8 \cdot 10^{+75}:\\
\;\;\;\;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 < 5.7999999999999997e75Initial program 89.4%
associate--l+89.4%
distribute-lft-out--91.4%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.3%
if 5.7999999999999997e75 < d4 Initial program 89.3%
associate--l+89.3%
distribute-lft-out--89.2%
distribute-rgt-out--93.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 95.6%
Final simplification87.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 6.2e-307) (* d1 d2) (if (<= d4 1.2e+105) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6.2e-307) {
tmp = d1 * d2;
} else if (d4 <= 1.2e+105) {
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.2d-307) then
tmp = d1 * d2
else if (d4 <= 1.2d+105) 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.2e-307) {
tmp = d1 * d2;
} else if (d4 <= 1.2e+105) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 6.2e-307: tmp = d1 * d2 elif d4 <= 1.2e+105: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 6.2e-307) tmp = Float64(d1 * d2); elseif (d4 <= 1.2e+105) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 6.2e-307) tmp = d1 * d2; elseif (d4 <= 1.2e+105) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 6.2e-307], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.2e+105], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 6.2 \cdot 10^{-307}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.2 \cdot 10^{+105}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 6.1999999999999996e-307Initial program 86.6%
associate--l+86.6%
distribute-lft-out--88.9%
distribute-rgt-out--92.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.6%
if 6.1999999999999996e-307 < d4 < 1.19999999999999987e105Initial program 94.4%
associate--l+94.4%
distribute-lft-out--95.5%
distribute-rgt-out--95.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 45.3%
neg-mul-145.3%
unpow245.3%
distribute-rgt-neg-in45.3%
Simplified45.3%
if 1.19999999999999987e105 < d4 Initial program 87.1%
associate--l+87.1%
distribute-lft-out--87.1%
distribute-rgt-out--92.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 62.2%
Final simplification43.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.6e+41) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.6e+41) {
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.6d+41) 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.6e+41) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.6e+41: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.6e+41) 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.6e+41) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.6e+41], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.6 \cdot 10^{+41}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 3.60000000000000025e41Initial program 89.8%
associate--l+89.8%
distribute-lft-out--91.7%
distribute-rgt-out--93.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 34.5%
if 3.60000000000000025e41 < d4 Initial program 87.9%
associate--l+87.9%
distribute-lft-out--87.9%
distribute-rgt-out--91.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 56.6%
Final simplification38.8%
(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--91.0%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 28.2%
Final simplification28.2%
(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 2023201
(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)))