
(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 88.2%
associate--l+88.2%
distribute-lft-out--88.2%
distribute-rgt-out--90.2%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d2 -4.5e+65)
t_0
(if (<= d2 -0.0152)
(* d1 (- d2 d1))
(if (<= d2 -2.3e-46)
t_0
(if (or (<= d2 -4.4e-263)
(and (not (<= d2 -2.25e-299)) (<= d2 2.3e-271)))
(* d1 (- d4 d1))
(* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d2 <= -4.5e+65) {
tmp = t_0;
} else if (d2 <= -0.0152) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -2.3e-46) {
tmp = t_0;
} else if ((d2 <= -4.4e-263) || (!(d2 <= -2.25e-299) && (d2 <= 2.3e-271))) {
tmp = d1 * (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) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d2 <= (-4.5d+65)) then
tmp = t_0
else if (d2 <= (-0.0152d0)) then
tmp = d1 * (d2 - d1)
else if (d2 <= (-2.3d-46)) then
tmp = t_0
else if ((d2 <= (-4.4d-263)) .or. (.not. (d2 <= (-2.25d-299))) .and. (d2 <= 2.3d-271)) then
tmp = d1 * (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 t_0 = d1 * (d2 - d3);
double tmp;
if (d2 <= -4.5e+65) {
tmp = t_0;
} else if (d2 <= -0.0152) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -2.3e-46) {
tmp = t_0;
} else if ((d2 <= -4.4e-263) || (!(d2 <= -2.25e-299) && (d2 <= 2.3e-271))) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d2 <= -4.5e+65: tmp = t_0 elif d2 <= -0.0152: tmp = d1 * (d2 - d1) elif d2 <= -2.3e-46: tmp = t_0 elif (d2 <= -4.4e-263) or (not (d2 <= -2.25e-299) and (d2 <= 2.3e-271)): tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d2 <= -4.5e+65) tmp = t_0; elseif (d2 <= -0.0152) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d2 <= -2.3e-46) tmp = t_0; elseif ((d2 <= -4.4e-263) || (!(d2 <= -2.25e-299) && (d2 <= 2.3e-271))) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d2 <= -4.5e+65) tmp = t_0; elseif (d2 <= -0.0152) tmp = d1 * (d2 - d1); elseif (d2 <= -2.3e-46) tmp = t_0; elseif ((d2 <= -4.4e-263) || (~((d2 <= -2.25e-299)) && (d2 <= 2.3e-271))) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -4.5e+65], t$95$0, If[LessEqual[d2, -0.0152], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -2.3e-46], t$95$0, If[Or[LessEqual[d2, -4.4e-263], And[N[Not[LessEqual[d2, -2.25e-299]], $MachinePrecision], LessEqual[d2, 2.3e-271]]], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d2 \leq -4.5 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -0.0152:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -2.3 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -4.4 \cdot 10^{-263} \lor \neg \left(d2 \leq -2.25 \cdot 10^{-299}\right) \land d2 \leq 2.3 \cdot 10^{-271}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -4.5e65 or -0.0152 < d2 < -2.2999999999999999e-46Initial program 92.5%
associate--l+92.5%
distribute-lft-out--92.5%
distribute-rgt-out--97.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 92.6%
+-commutative92.6%
associate--r+92.6%
Simplified92.6%
Taylor expanded in d1 around 0 87.8%
if -4.5e65 < d2 < -0.0152Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.4%
distribute-rgt-out--93.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 57.7%
+-commutative57.7%
associate--r+57.7%
Simplified57.7%
Taylor expanded in d3 around 0 49.8%
if -2.2999999999999999e-46 < d2 < -4.4000000000000001e-263 or -2.25000000000000001e-299 < d2 < 2.30000000000000009e-271Initial program 86.2%
associate--l+86.2%
distribute-lft-out--86.2%
distribute-rgt-out--89.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 97.3%
associate--r+97.3%
Simplified97.3%
Taylor expanded in d3 around 0 83.9%
if -4.4000000000000001e-263 < d2 < -2.25000000000000001e-299 or 2.30000000000000009e-271 < d2 Initial program 88.0%
associate--l+88.0%
distribute-lft-out--88.0%
distribute-rgt-out--88.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 92.9%
Taylor expanded in d1 around 0 82.5%
Taylor expanded in d2 around 0 59.5%
Final simplification68.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d2 -4.8e+65)
t_0
(if (<= d2 -18.0)
(* d1 (- d2 d1))
(if (<= d2 -6e-48)
t_0
(if (or (<= d2 -9.5e-266) (not (<= d2 -7.5e-279)))
(* d1 (- d4 d1))
(* d1 (- d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d2 <= -4.8e+65) {
tmp = t_0;
} else if (d2 <= -18.0) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -6e-48) {
tmp = t_0;
} else if ((d2 <= -9.5e-266) || !(d2 <= -7.5e-279)) {
tmp = d1 * (d4 - d1);
} else {
tmp = 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) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d2 <= (-4.8d+65)) then
tmp = t_0
else if (d2 <= (-18.0d0)) then
tmp = d1 * (d2 - d1)
else if (d2 <= (-6d-48)) then
tmp = t_0
else if ((d2 <= (-9.5d-266)) .or. (.not. (d2 <= (-7.5d-279)))) then
tmp = d1 * (d4 - d1)
else
tmp = d1 * -d3
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d2 <= -4.8e+65) {
tmp = t_0;
} else if (d2 <= -18.0) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -6e-48) {
tmp = t_0;
} else if ((d2 <= -9.5e-266) || !(d2 <= -7.5e-279)) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * -d3;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d2 <= -4.8e+65: tmp = t_0 elif d2 <= -18.0: tmp = d1 * (d2 - d1) elif d2 <= -6e-48: tmp = t_0 elif (d2 <= -9.5e-266) or not (d2 <= -7.5e-279): tmp = d1 * (d4 - d1) else: tmp = d1 * -d3 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d2 <= -4.8e+65) tmp = t_0; elseif (d2 <= -18.0) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d2 <= -6e-48) tmp = t_0; elseif ((d2 <= -9.5e-266) || !(d2 <= -7.5e-279)) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(-d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d2 <= -4.8e+65) tmp = t_0; elseif (d2 <= -18.0) tmp = d1 * (d2 - d1); elseif (d2 <= -6e-48) tmp = t_0; elseif ((d2 <= -9.5e-266) || ~((d2 <= -7.5e-279))) tmp = d1 * (d4 - d1); else tmp = d1 * -d3; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -4.8e+65], t$95$0, If[LessEqual[d2, -18.0], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -6e-48], t$95$0, If[Or[LessEqual[d2, -9.5e-266], N[Not[LessEqual[d2, -7.5e-279]], $MachinePrecision]], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * (-d3)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d2 \leq -4.8 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -18:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -6 \cdot 10^{-48}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -9.5 \cdot 10^{-266} \lor \neg \left(d2 \leq -7.5 \cdot 10^{-279}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\end{array}
\end{array}
if d2 < -4.8000000000000003e65 or -18 < d2 < -5.9999999999999998e-48Initial program 92.5%
associate--l+92.5%
distribute-lft-out--92.5%
distribute-rgt-out--97.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 92.6%
+-commutative92.6%
associate--r+92.6%
Simplified92.6%
Taylor expanded in d1 around 0 87.8%
if -4.8000000000000003e65 < d2 < -18Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.4%
distribute-rgt-out--93.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 57.7%
+-commutative57.7%
associate--r+57.7%
Simplified57.7%
Taylor expanded in d3 around 0 49.8%
if -5.9999999999999998e-48 < d2 < -9.49999999999999951e-266 or -7.5e-279 < d2 Initial program 87.3%
associate--l+87.3%
distribute-lft-out--87.3%
distribute-rgt-out--88.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 83.2%
associate--r+83.2%
Simplified83.2%
Taylor expanded in d3 around 0 64.0%
if -9.49999999999999951e-266 < d2 < -7.5e-279Initial program 99.5%
associate--l+99.5%
distribute-lft-out--99.5%
distribute-rgt-out--99.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 66.9%
associate-*r*66.9%
neg-mul-166.9%
Simplified66.9%
Final simplification66.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -4.8e+65)
(* d1 (- d2 d3))
(if (<= d2 -280000000000.0)
(* d1 (+ d2 d4))
(if (<= d2 -2.3e-284) (* d1 (- (- d3) d1)) (* d1 (- d4 d3))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.8e+65) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -280000000000.0) {
tmp = d1 * (d2 + d4);
} else if (d2 <= -2.3e-284) {
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 <= (-4.8d+65)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-280000000000.0d0)) then
tmp = d1 * (d2 + d4)
else if (d2 <= (-2.3d-284)) 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 <= -4.8e+65) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -280000000000.0) {
tmp = d1 * (d2 + d4);
} else if (d2 <= -2.3e-284) {
tmp = d1 * (-d3 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.8e+65: tmp = d1 * (d2 - d3) elif d2 <= -280000000000.0: tmp = d1 * (d2 + d4) elif d2 <= -2.3e-284: tmp = d1 * (-d3 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.8e+65) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -280000000000.0) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d2 <= -2.3e-284) tmp = Float64(d1 * Float64(Float64(-d3) - 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 <= -4.8e+65) tmp = d1 * (d2 - d3); elseif (d2 <= -280000000000.0) tmp = d1 * (d2 + d4); elseif (d2 <= -2.3e-284) tmp = d1 * (-d3 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.8e+65], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -280000000000.0], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -2.3e-284], N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.8 \cdot 10^{+65}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -280000000000:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d2 \leq -2.3 \cdot 10^{-284}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -4.8000000000000003e65Initial program 91.4%
associate--l+91.4%
distribute-lft-out--91.4%
distribute-rgt-out--97.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 94.4%
+-commutative94.4%
associate--r+94.4%
Simplified94.4%
Taylor expanded in d1 around 0 91.5%
if -4.8000000000000003e65 < d2 < -2.8e11Initial program 85.7%
associate--l+85.7%
distribute-lft-out--85.6%
distribute-rgt-out--92.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 100.0%
Taylor expanded in d1 around 0 78.5%
Taylor expanded in d3 around 0 76.7%
+-commutative76.7%
Simplified76.7%
if -2.8e11 < d2 < -2.3e-284Initial program 87.2%
associate--l+87.2%
distribute-lft-out--87.2%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 91.9%
associate--r+91.9%
Simplified91.9%
Taylor expanded in d4 around 0 69.3%
associate-*r*69.3%
mul-1-neg69.3%
Simplified69.3%
if -2.3e-284 < d2 Initial program 88.1%
associate--l+88.1%
distribute-lft-out--88.1%
distribute-rgt-out--88.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 93.4%
Taylor expanded in d1 around 0 80.4%
Taylor expanded in d2 around 0 59.0%
Final simplification66.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 1.8e-182)
t_0
(if (<= d4 6.1e-134)
(* d1 (- d2 d3))
(if (<= d4 7.6e-13) t_0 (* d1 (+ d2 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 1.8e-182) {
tmp = t_0;
} else if (d4 <= 6.1e-134) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 7.6e-13) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d1)
if (d4 <= 1.8d-182) then
tmp = t_0
else if (d4 <= 6.1d-134) then
tmp = d1 * (d2 - d3)
else if (d4 <= 7.6d-13) then
tmp = t_0
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 1.8e-182) {
tmp = t_0;
} else if (d4 <= 6.1e-134) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 7.6e-13) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= 1.8e-182: tmp = t_0 elif d4 <= 6.1e-134: tmp = d1 * (d2 - d3) elif d4 <= 7.6e-13: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= 1.8e-182) tmp = t_0; elseif (d4 <= 6.1e-134) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 7.6e-13) tmp = t_0; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d4 <= 1.8e-182) tmp = t_0; elseif (d4 <= 6.1e-134) tmp = d1 * (d2 - d3); elseif (d4 <= 7.6e-13) tmp = t_0; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 1.8e-182], t$95$0, If[LessEqual[d4, 6.1e-134], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 7.6e-13], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq 1.8 \cdot 10^{-182}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 6.1 \cdot 10^{-134}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 7.6 \cdot 10^{-13}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 1.79999999999999988e-182 or 6.0999999999999996e-134 < d4 < 7.5999999999999999e-13Initial program 86.8%
associate--l+86.8%
distribute-lft-out--86.8%
distribute-rgt-out--88.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.4%
+-commutative81.4%
associate--r+81.4%
Simplified81.4%
Taylor expanded in d3 around 0 61.4%
if 1.79999999999999988e-182 < d4 < 6.0999999999999996e-134Initial 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 d4 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.2%
if 7.5999999999999999e-13 < d4 Initial program 90.6%
associate--l+90.6%
distribute-lft-out--90.6%
distribute-rgt-out--93.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 100.0%
Taylor expanded in d1 around 0 86.6%
Taylor expanded in d3 around 0 73.0%
+-commutative73.0%
Simplified73.0%
Final simplification65.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -4.4e+36) (not (<= d3 1.05e+91))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -4.4e+36) || !(d3 <= 1.05e+91)) {
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 <= (-4.4d+36)) .or. (.not. (d3 <= 1.05d+91))) 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 <= -4.4e+36) || !(d3 <= 1.05e+91)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -4.4e+36) or not (d3 <= 1.05e+91): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -4.4e+36) || !(d3 <= 1.05e+91)) 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 <= -4.4e+36) || ~((d3 <= 1.05e+91))) 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, -4.4e+36], N[Not[LessEqual[d3, 1.05e+91]], $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 -4.4 \cdot 10^{+36} \lor \neg \left(d3 \leq 1.05 \cdot 10^{+91}\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 < -4.40000000000000001e36 or 1.05000000000000004e91 < d3 Initial program 81.1%
associate--l+81.1%
distribute-lft-out--81.1%
distribute-rgt-out--82.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 96.5%
Taylor expanded in d1 around 0 95.2%
if -4.40000000000000001e36 < d3 < 1.05000000000000004e91Initial program 91.8%
associate--l+91.8%
distribute-lft-out--91.8%
distribute-rgt-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.4%
Final simplification97.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -7.8e+183) (* d1 (- (- d3) d1)) (if (<= d3 3.7e+95) (* d1 (- (+ d2 d4) d1)) (* d1 (- d2 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -7.8e+183) {
tmp = d1 * (-d3 - d1);
} else if (d3 <= 3.7e+95) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d3 <= (-7.8d+183)) then
tmp = d1 * (-d3 - d1)
else if (d3 <= 3.7d+95) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * (d2 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -7.8e+183) {
tmp = d1 * (-d3 - d1);
} else if (d3 <= 3.7e+95) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -7.8e+183: tmp = d1 * (-d3 - d1) elif d3 <= 3.7e+95: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d2 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -7.8e+183) tmp = Float64(d1 * Float64(Float64(-d3) - d1)); elseif (d3 <= 3.7e+95) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d2 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -7.8e+183) tmp = d1 * (-d3 - d1); elseif (d3 <= 3.7e+95) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d2 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -7.8e+183], N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 3.7e+95], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -7.8 \cdot 10^{+183}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{elif}\;d3 \leq 3.7 \cdot 10^{+95}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\end{array}
\end{array}
if d3 < -7.7999999999999998e183Initial program 68.8%
associate--l+68.8%
distribute-lft-out--68.8%
distribute-rgt-out--68.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d4 around 0 100.0%
associate-*r*100.0%
mul-1-neg100.0%
Simplified100.0%
if -7.7999999999999998e183 < d3 < 3.7000000000000001e95Initial program 91.2%
associate--l+91.2%
distribute-lft-out--91.2%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.1%
if 3.7000000000000001e95 < d3 Initial program 82.6%
associate--l+82.6%
distribute-lft-out--82.6%
distribute-rgt-out--84.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.3%
+-commutative85.3%
associate--r+85.3%
Simplified85.3%
Taylor expanded in d1 around 0 85.3%
Final simplification93.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -1e+91) (* d1 (- (- d4 d1) d3)) (if (<= d3 1.35e+91) (* d1 (- (+ d2 d4) d1)) (* d1 (- (+ d2 d4) d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1e+91) {
tmp = d1 * ((d4 - d1) - d3);
} else if (d3 <= 1.35e+91) {
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 (d3 <= (-1d+91)) then
tmp = d1 * ((d4 - d1) - d3)
else if (d3 <= 1.35d+91) 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 (d3 <= -1e+91) {
tmp = d1 * ((d4 - d1) - d3);
} else if (d3 <= 1.35e+91) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -1e+91: tmp = d1 * ((d4 - d1) - d3) elif d3 <= 1.35e+91: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -1e+91) tmp = Float64(d1 * Float64(Float64(d4 - d1) - d3)); elseif (d3 <= 1.35e+91) 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 (d3 <= -1e+91) tmp = d1 * ((d4 - d1) - d3); elseif (d3 <= 1.35e+91) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -1e+91], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.35e+91], 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}\;d3 \leq -1 \cdot 10^{+91}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\mathbf{elif}\;d3 \leq 1.35 \cdot 10^{+91}:\\
\;\;\;\;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 d3 < -1.00000000000000008e91Initial program 77.7%
associate--l+77.7%
distribute-lft-out--77.7%
distribute-rgt-out--77.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 86.7%
associate--r+86.7%
Simplified86.7%
if -1.00000000000000008e91 < d3 < 1.35e91Initial program 91.9%
associate--l+91.9%
distribute-lft-out--91.9%
distribute-rgt-out--94.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.3%
if 1.35e91 < d3 Initial program 82.6%
associate--l+82.6%
distribute-lft-out--82.6%
distribute-rgt-out--84.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 93.5%
Taylor expanded in d1 around 0 99.9%
Final simplification96.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.35e+184) (not (<= d3 4.3e+170))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.35e+184) || !(d3 <= 4.3e+170)) {
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.35d+184)) .or. (.not. (d3 <= 4.3d+170))) 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.35e+184) || !(d3 <= 4.3e+170)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.35e+184) or not (d3 <= 4.3e+170): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.35e+184) || !(d3 <= 4.3e+170)) 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.35e+184) || ~((d3 <= 4.3e+170))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.35e+184], N[Not[LessEqual[d3, 4.3e+170]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.35 \cdot 10^{+184} \lor \neg \left(d3 \leq 4.3 \cdot 10^{+170}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.35e184 or 4.2999999999999999e170 < d3 Initial program 76.7%
associate--l+76.7%
distribute-lft-out--76.7%
distribute-rgt-out--76.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 95.4%
associate-*r*95.4%
neg-mul-195.4%
Simplified95.4%
if -1.35e184 < d3 < 4.2999999999999999e170Initial program 90.6%
associate--l+90.6%
distribute-lft-out--90.6%
distribute-rgt-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 95.8%
Taylor expanded in d1 around 0 75.4%
Taylor expanded in d3 around 0 67.9%
+-commutative67.9%
Simplified67.9%
Final simplification72.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -290000.0) (* d1 d2) (if (<= d2 -1.75e-299) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -290000.0) {
tmp = d1 * d2;
} else if (d2 <= -1.75e-299) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-290000.0d0)) then
tmp = d1 * d2
else if (d2 <= (-1.75d-299)) then
tmp = d1 * -d3
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -290000.0) {
tmp = d1 * d2;
} else if (d2 <= -1.75e-299) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -290000.0: tmp = d1 * d2 elif d2 <= -1.75e-299: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -290000.0) tmp = Float64(d1 * d2); elseif (d2 <= -1.75e-299) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -290000.0) tmp = d1 * d2; elseif (d2 <= -1.75e-299) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -290000.0], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -1.75e-299], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -290000:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -1.75 \cdot 10^{-299}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -2.9e5Initial program 90.2%
associate--l+90.2%
distribute-lft-out--90.1%
distribute-rgt-out--96.0%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around inf 62.1%
if -2.9e5 < d2 < -1.74999999999999995e-299Initial program 87.7%
associate--l+87.7%
distribute-lft-out--87.7%
distribute-rgt-out--91.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 35.2%
associate-*r*35.2%
neg-mul-135.2%
Simplified35.2%
if -1.74999999999999995e-299 < d2 Initial program 87.8%
associate--l+87.8%
distribute-lft-out--87.8%
distribute-rgt-out--87.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 36.7%
Final simplification41.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 8.2e-13) (* d1 (- d2 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.2e-13) {
tmp = d1 * (d2 - 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 <= 8.2d-13) then
tmp = d1 * (d2 - 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 <= 8.2e-13) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 8.2e-13: tmp = d1 * (d2 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 8.2e-13) tmp = Float64(d1 * Float64(d2 - 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 <= 8.2e-13) tmp = d1 * (d2 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 8.2e-13], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 8.2 \cdot 10^{-13}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 8.2000000000000004e-13Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--89.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.3%
+-commutative82.3%
associate--r+82.3%
Simplified82.3%
Taylor expanded in d3 around 0 61.3%
if 8.2000000000000004e-13 < d4 Initial program 90.6%
associate--l+90.6%
distribute-lft-out--90.6%
distribute-rgt-out--93.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 100.0%
Taylor expanded in d1 around 0 86.6%
Taylor expanded in d3 around 0 73.0%
+-commutative73.0%
Simplified73.0%
Final simplification64.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -3.2e-20) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3.2e-20) {
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 (d2 <= (-3.2d-20)) 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 (d2 <= -3.2e-20) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -3.2e-20: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -3.2e-20) 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 (d2 <= -3.2e-20) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -3.2e-20], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -3.2 \cdot 10^{-20}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -3.1999999999999997e-20Initial program 90.9%
associate--l+90.9%
distribute-lft-out--90.9%
distribute-rgt-out--96.3%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around inf 59.7%
if -3.1999999999999997e-20 < d2 Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--88.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 37.4%
Final simplification42.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
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
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 88.2%
associate--l+88.2%
distribute-lft-out--88.2%
distribute-rgt-out--90.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.9%
Final simplification30.9%
(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 2024055
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))