
(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 (- (- d4 d3) (- d1 d2))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - d3) - (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 * ((d4 - d3) - (d1 - d2))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - d3) - (d1 - d2));
}
def code(d1, d2, d3, d4): return d1 * ((d4 - d3) - (d1 - d2))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d4 - d3) - Float64(d1 - d2))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d4 - d3) - (d1 - d2)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - N[(d1 - d2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d4 - d3\right) - \left(d1 - d2\right)\right)
\end{array}
Initial program 87.9%
sub-neg87.9%
associate-+l+87.9%
*-commutative87.9%
+-commutative87.9%
*-commutative87.9%
sub-neg87.9%
+-commutative87.9%
associate--l+87.9%
distribute-lft-out--89.0%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (- d4 d1))))
(if (<= d2 -1.6e+128)
t_0
(if (<= d2 -2e+65)
t_1
(if (<= d2 -1.52e+53)
t_0
(if (or (<= d2 -1.25e-234) (not (<= d2 -7.8e-264)))
t_1
(* d1 (- d3))))))))
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 <= -1.6e+128) {
tmp = t_0;
} else if (d2 <= -2e+65) {
tmp = t_1;
} else if (d2 <= -1.52e+53) {
tmp = t_0;
} else if ((d2 <= -1.25e-234) || !(d2 <= -7.8e-264)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * (d4 - d1)
if (d2 <= (-1.6d+128)) then
tmp = t_0
else if (d2 <= (-2d+65)) then
tmp = t_1
else if (d2 <= (-1.52d+53)) then
tmp = t_0
else if ((d2 <= (-1.25d-234)) .or. (.not. (d2 <= (-7.8d-264)))) then
tmp = t_1
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 t_1 = d1 * (d4 - d1);
double tmp;
if (d2 <= -1.6e+128) {
tmp = t_0;
} else if (d2 <= -2e+65) {
tmp = t_1;
} else if (d2 <= -1.52e+53) {
tmp = t_0;
} else if ((d2 <= -1.25e-234) || !(d2 <= -7.8e-264)) {
tmp = t_1;
} else {
tmp = d1 * -d3;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d4 - d1) tmp = 0 if d2 <= -1.6e+128: tmp = t_0 elif d2 <= -2e+65: tmp = t_1 elif d2 <= -1.52e+53: tmp = t_0 elif (d2 <= -1.25e-234) or not (d2 <= -7.8e-264): tmp = t_1 else: tmp = d1 * -d3 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 <= -1.6e+128) tmp = t_0; elseif (d2 <= -2e+65) tmp = t_1; elseif (d2 <= -1.52e+53) tmp = t_0; elseif ((d2 <= -1.25e-234) || !(d2 <= -7.8e-264)) tmp = t_1; else tmp = Float64(d1 * Float64(-d3)); 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 <= -1.6e+128) tmp = t_0; elseif (d2 <= -2e+65) tmp = t_1; elseif (d2 <= -1.52e+53) tmp = t_0; elseif ((d2 <= -1.25e-234) || ~((d2 <= -7.8e-264))) tmp = t_1; 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]}, Block[{t$95$1 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -1.6e+128], t$95$0, If[LessEqual[d2, -2e+65], t$95$1, If[LessEqual[d2, -1.52e+53], t$95$0, If[Or[LessEqual[d2, -1.25e-234], N[Not[LessEqual[d2, -7.8e-264]], $MachinePrecision]], t$95$1, N[(d1 * (-d3)), $MachinePrecision]]]]]]]
\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 -1.6 \cdot 10^{+128}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -2 \cdot 10^{+65}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -1.52 \cdot 10^{+53}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -1.25 \cdot 10^{-234} \lor \neg \left(d2 \leq -7.8 \cdot 10^{-264}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\end{array}
\end{array}
if d2 < -1.59999999999999993e128 or -2e65 < d2 < -1.52e53Initial program 91.3%
sub-neg91.3%
associate-+l+91.3%
*-commutative91.3%
+-commutative91.3%
*-commutative91.3%
sub-neg91.3%
+-commutative91.3%
associate--l+91.3%
distribute-lft-out--91.3%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in97.8%
associate--l-97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in d1 around 0 95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in d4 around 0 87.4%
if -1.59999999999999993e128 < d2 < -2e65 or -1.52e53 < d2 < -1.24999999999999995e-234 or -7.7999999999999997e-264 < d2 Initial program 87.6%
sub-neg87.6%
associate-+l+87.6%
*-commutative87.6%
+-commutative87.6%
*-commutative87.6%
sub-neg87.6%
+-commutative87.6%
associate--l+87.6%
distribute-lft-out--89.1%
distribute-rgt-out--91.6%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.5%
Taylor expanded in d2 around 0 64.1%
if -1.24999999999999995e-234 < d2 < -7.7999999999999997e-264Initial program 75.0%
sub-neg75.0%
associate-+l+75.0%
*-commutative75.0%
+-commutative75.0%
*-commutative75.0%
sub-neg75.0%
+-commutative75.0%
associate--l+75.0%
distribute-lft-out--75.0%
distribute-rgt-out--75.0%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 75.1%
mul-1-neg75.1%
distribute-rgt-neg-out75.1%
Simplified75.1%
Final simplification68.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (- d4 d1))))
(if (<= d2 -4.8e+129)
t_0
(if (<= d2 -9.6e+62)
t_1
(if (<= d2 -1.35e+53)
t_0
(if (or (<= d2 -1.25e-223) (not (<= d2 1.9e-74)))
t_1
(* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 - d1);
double tmp;
if (d2 <= -4.8e+129) {
tmp = t_0;
} else if (d2 <= -9.6e+62) {
tmp = t_1;
} else if (d2 <= -1.35e+53) {
tmp = t_0;
} else if ((d2 <= -1.25e-223) || !(d2 <= 1.9e-74)) {
tmp = t_1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * (d4 - d1)
if (d2 <= (-4.8d+129)) then
tmp = t_0
else if (d2 <= (-9.6d+62)) then
tmp = t_1
else if (d2 <= (-1.35d+53)) then
tmp = t_0
else if ((d2 <= (-1.25d-223)) .or. (.not. (d2 <= 1.9d-74))) then
tmp = t_1
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 - d1);
double tmp;
if (d2 <= -4.8e+129) {
tmp = t_0;
} else if (d2 <= -9.6e+62) {
tmp = t_1;
} else if (d2 <= -1.35e+53) {
tmp = t_0;
} else if ((d2 <= -1.25e-223) || !(d2 <= 1.9e-74)) {
tmp = t_1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d4 - d1) tmp = 0 if d2 <= -4.8e+129: tmp = t_0 elif d2 <= -9.6e+62: tmp = t_1 elif d2 <= -1.35e+53: tmp = t_0 elif (d2 <= -1.25e-223) or not (d2 <= 1.9e-74): tmp = t_1 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d4 - d1)) tmp = 0.0 if (d2 <= -4.8e+129) tmp = t_0; elseif (d2 <= -9.6e+62) tmp = t_1; elseif (d2 <= -1.35e+53) tmp = t_0; elseif ((d2 <= -1.25e-223) || !(d2 <= 1.9e-74)) tmp = t_1; else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d4 - d1); tmp = 0.0; if (d2 <= -4.8e+129) tmp = t_0; elseif (d2 <= -9.6e+62) tmp = t_1; elseif (d2 <= -1.35e+53) tmp = t_0; elseif ((d2 <= -1.25e-223) || ~((d2 <= 1.9e-74))) tmp = t_1; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -4.8e+129], t$95$0, If[LessEqual[d2, -9.6e+62], t$95$1, If[LessEqual[d2, -1.35e+53], t$95$0, If[Or[LessEqual[d2, -1.25e-223], N[Not[LessEqual[d2, 1.9e-74]], $MachinePrecision]], t$95$1, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d4 - d1\right)\\
\mathbf{if}\;d2 \leq -4.8 \cdot 10^{+129}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -9.6 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -1.35 \cdot 10^{+53}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -1.25 \cdot 10^{-223} \lor \neg \left(d2 \leq 1.9 \cdot 10^{-74}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -4.7999999999999997e129 or -9.6e62 < d2 < -1.3500000000000001e53Initial program 91.3%
sub-neg91.3%
associate-+l+91.3%
*-commutative91.3%
+-commutative91.3%
*-commutative91.3%
sub-neg91.3%
+-commutative91.3%
associate--l+91.3%
distribute-lft-out--91.3%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in97.8%
associate--l-97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in d1 around 0 95.7%
+-commutative95.7%
Simplified95.7%
Taylor expanded in d4 around 0 87.4%
if -4.7999999999999997e129 < d2 < -9.6e62 or -1.3500000000000001e53 < d2 < -1.25000000000000006e-223 or 1.8999999999999998e-74 < d2 Initial program 86.1%
sub-neg86.1%
associate-+l+86.1%
*-commutative86.1%
+-commutative86.1%
*-commutative86.1%
sub-neg86.1%
+-commutative86.1%
associate--l+86.1%
distribute-lft-out--87.5%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 79.9%
Taylor expanded in d2 around 0 63.9%
if -1.25000000000000006e-223 < d2 < 1.8999999999999998e-74Initial program 89.4%
sub-neg89.4%
associate-+l+89.4%
*-commutative89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
distribute-lft-out--90.9%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d1 around 0 77.4%
Final simplification71.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d3 -2.4e+113)
(* d1 (- d2 d3))
(if (or (<= d3 1.65e+83) (and (not (<= d3 3.4e+130)) (<= d3 2.2e+190)))
(* d1 (- (+ d2 d4) d1))
(* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.4e+113) {
tmp = d1 * (d2 - d3);
} else if ((d3 <= 1.65e+83) || (!(d3 <= 3.4e+130) && (d3 <= 2.2e+190))) {
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 <= (-2.4d+113)) then
tmp = d1 * (d2 - d3)
else if ((d3 <= 1.65d+83) .or. (.not. (d3 <= 3.4d+130)) .and. (d3 <= 2.2d+190)) 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 <= -2.4e+113) {
tmp = d1 * (d2 - d3);
} else if ((d3 <= 1.65e+83) || (!(d3 <= 3.4e+130) && (d3 <= 2.2e+190))) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -2.4e+113: tmp = d1 * (d2 - d3) elif (d3 <= 1.65e+83) or (not (d3 <= 3.4e+130) and (d3 <= 2.2e+190)): tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -2.4e+113) tmp = Float64(d1 * Float64(d2 - d3)); elseif ((d3 <= 1.65e+83) || (!(d3 <= 3.4e+130) && (d3 <= 2.2e+190))) 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 <= -2.4e+113) tmp = d1 * (d2 - d3); elseif ((d3 <= 1.65e+83) || (~((d3 <= 3.4e+130)) && (d3 <= 2.2e+190))) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -2.4e+113], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d3, 1.65e+83], And[N[Not[LessEqual[d3, 3.4e+130]], $MachinePrecision], LessEqual[d3, 2.2e+190]]], 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 -2.4 \cdot 10^{+113}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 1.65 \cdot 10^{+83} \lor \neg \left(d3 \leq 3.4 \cdot 10^{+130}\right) \land d3 \leq 2.2 \cdot 10^{+190}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -2.39999999999999983e113Initial program 83.3%
sub-neg83.3%
associate-+l+83.3%
*-commutative83.3%
+-commutative83.3%
*-commutative83.3%
sub-neg83.3%
+-commutative83.3%
associate--l+83.3%
distribute-lft-out--88.9%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in91.7%
associate--l-91.7%
*-commutative91.7%
Applied egg-rr91.7%
Taylor expanded in d1 around 0 94.4%
+-commutative94.4%
Simplified94.4%
Taylor expanded in d4 around 0 83.7%
if -2.39999999999999983e113 < d3 < 1.64999999999999992e83 or 3.4000000000000001e130 < d3 < 2.2e190Initial program 89.2%
sub-neg89.2%
associate-+l+89.2%
*-commutative89.2%
+-commutative89.2%
*-commutative89.2%
sub-neg89.2%
+-commutative89.2%
associate--l+89.2%
distribute-lft-out--89.2%
distribute-rgt-out--91.3%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.2%
if 1.64999999999999992e83 < d3 < 3.4000000000000001e130 or 2.2e190 < d3 Initial program 85.7%
sub-neg85.7%
associate-+l+85.7%
*-commutative85.7%
+-commutative85.7%
*-commutative85.7%
sub-neg85.7%
+-commutative85.7%
associate--l+85.7%
distribute-lft-out--88.5%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 96.2%
+-commutative96.2%
associate--r+96.2%
Simplified96.2%
Taylor expanded in d1 around 0 93.4%
Final simplification91.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- (- d3) d1))))
(if (<= d2 -8.5e+119)
(* d1 (- d2 d3))
(if (<= d2 -1.15e+100)
t_0
(if (<= d2 -1.85e+50)
(* d1 (- d4 d3))
(if (<= d2 1.75e-136) t_0 (* d1 (- d4 d1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (-d3 - d1);
double tmp;
if (d2 <= -8.5e+119) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.15e+100) {
tmp = t_0;
} else if (d2 <= -1.85e+50) {
tmp = d1 * (d4 - d3);
} else if (d2 <= 1.75e-136) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = d1 * (-d3 - d1)
if (d2 <= (-8.5d+119)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-1.15d+100)) then
tmp = t_0
else if (d2 <= (-1.85d+50)) then
tmp = d1 * (d4 - d3)
else if (d2 <= 1.75d-136) then
tmp = t_0
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (-d3 - d1);
double tmp;
if (d2 <= -8.5e+119) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.15e+100) {
tmp = t_0;
} else if (d2 <= -1.85e+50) {
tmp = d1 * (d4 - d3);
} else if (d2 <= 1.75e-136) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (-d3 - d1) tmp = 0 if d2 <= -8.5e+119: tmp = d1 * (d2 - d3) elif d2 <= -1.15e+100: tmp = t_0 elif d2 <= -1.85e+50: tmp = d1 * (d4 - d3) elif d2 <= 1.75e-136: tmp = t_0 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(Float64(-d3) - d1)) tmp = 0.0 if (d2 <= -8.5e+119) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -1.15e+100) tmp = t_0; elseif (d2 <= -1.85e+50) tmp = Float64(d1 * Float64(d4 - d3)); elseif (d2 <= 1.75e-136) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (-d3 - d1); tmp = 0.0; if (d2 <= -8.5e+119) tmp = d1 * (d2 - d3); elseif (d2 <= -1.15e+100) tmp = t_0; elseif (d2 <= -1.85e+50) tmp = d1 * (d4 - d3); elseif (d2 <= 1.75e-136) tmp = t_0; else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -8.5e+119], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -1.15e+100], t$95$0, If[LessEqual[d2, -1.85e+50], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, 1.75e-136], t$95$0, N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{if}\;d2 \leq -8.5 \cdot 10^{+119}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -1.15 \cdot 10^{+100}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -1.85 \cdot 10^{+50}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{elif}\;d2 \leq 1.75 \cdot 10^{-136}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -8.49999999999999997e119Initial program 91.3%
sub-neg91.3%
associate-+l+91.3%
*-commutative91.3%
+-commutative91.3%
*-commutative91.3%
sub-neg91.3%
+-commutative91.3%
associate--l+91.3%
distribute-lft-out--91.3%
distribute-rgt-out--93.5%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in97.8%
associate--l-97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in d1 around 0 95.5%
+-commutative95.5%
Simplified95.5%
Taylor expanded in d4 around 0 87.3%
if -8.49999999999999997e119 < d2 < -1.14999999999999995e100 or -1.85e50 < d2 < 1.75000000000000015e-136Initial program 90.1%
sub-neg90.1%
associate-+l+90.1%
*-commutative90.1%
+-commutative90.1%
*-commutative90.1%
sub-neg90.1%
+-commutative90.1%
associate--l+90.1%
distribute-lft-out--91.1%
distribute-rgt-out--92.0%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 98.1%
+-commutative98.1%
associate--r+98.1%
Simplified98.1%
Taylor expanded in d4 around 0 78.9%
associate-*r*78.9%
neg-mul-178.9%
Simplified78.9%
if -1.14999999999999995e100 < d2 < -1.85e50Initial program 90.8%
sub-neg90.8%
associate-+l+90.8%
*-commutative90.8%
+-commutative90.8%
*-commutative90.8%
sub-neg90.8%
+-commutative90.8%
associate--l+90.8%
distribute-lft-out--90.8%
distribute-rgt-out--90.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 83.3%
+-commutative83.3%
associate--r+83.3%
Simplified83.3%
Taylor expanded in d1 around 0 83.0%
if 1.75000000000000015e-136 < d2 Initial program 83.7%
sub-neg83.7%
associate-+l+83.7%
*-commutative83.7%
+-commutative83.7%
*-commutative83.7%
sub-neg83.7%
+-commutative83.7%
associate--l+83.7%
distribute-lft-out--85.7%
distribute-rgt-out--89.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.8%
Taylor expanded in d2 around 0 59.3%
Final simplification73.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -7.9e+27) (not (<= d1 8.4e+14))) (* d1 (- (+ d2 d4) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -7.9e+27) || !(d1 <= 8.4e+14)) {
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 <= (-7.9d+27)) .or. (.not. (d1 <= 8.4d+14))) 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 <= -7.9e+27) || !(d1 <= 8.4e+14)) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -7.9e+27) or not (d1 <= 8.4e+14): tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -7.9e+27) || !(d1 <= 8.4e+14)) 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 <= -7.9e+27) || ~((d1 <= 8.4e+14))) 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, -7.9e+27], N[Not[LessEqual[d1, 8.4e+14]], $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 -7.9 \cdot 10^{+27} \lor \neg \left(d1 \leq 8.4 \cdot 10^{+14}\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 < -7.89999999999999991e27 or 8.4e14 < d1 Initial program 74.2%
sub-neg74.2%
associate-+l+74.2%
*-commutative74.2%
+-commutative74.2%
*-commutative74.2%
sub-neg74.2%
+-commutative74.2%
associate--l+74.2%
distribute-lft-out--76.7%
distribute-rgt-out--81.7%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.5%
if -7.89999999999999991e27 < d1 < 8.4e14Initial program 100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
+-commutative100.0%
*-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in100.0%
associate--l-100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in d1 around 0 98.5%
+-commutative98.5%
Simplified98.5%
Final simplification95.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d1 -18000000000000.0) (* d1 (- (- d2 d3) d1)) (if (<= d1 1100000.0) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d1 <= -18000000000000.0) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d1 <= 1100000.0) {
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 (d1 <= (-18000000000000.0d0)) then
tmp = d1 * ((d2 - d3) - d1)
else if (d1 <= 1100000.0d0) 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 (d1 <= -18000000000000.0) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d1 <= 1100000.0) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d1 <= -18000000000000.0: tmp = d1 * ((d2 - d3) - d1) elif d1 <= 1100000.0: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d1 <= -18000000000000.0) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); elseif (d1 <= 1100000.0) 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 (d1 <= -18000000000000.0) tmp = d1 * ((d2 - d3) - d1); elseif (d1 <= 1100000.0) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d1, -18000000000000.0], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 1100000.0], 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}\;d1 \leq -18000000000000:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{elif}\;d1 \leq 1100000:\\
\;\;\;\;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 d1 < -1.8e13Initial program 76.2%
sub-neg76.2%
associate-+l+76.2%
*-commutative76.2%
+-commutative76.2%
*-commutative76.2%
sub-neg76.2%
+-commutative76.2%
associate--l+76.2%
distribute-lft-out--79.4%
distribute-rgt-out--82.5%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 87.5%
+-commutative87.5%
associate--r+87.5%
Simplified87.5%
if -1.8e13 < d1 < 1.1e6Initial program 100.0%
sub-neg100.0%
associate-+l+100.0%
*-commutative100.0%
+-commutative100.0%
*-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in100.0%
associate--l-100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in d1 around 0 99.0%
+-commutative99.0%
Simplified99.0%
if 1.1e6 < d1 Initial program 73.3%
sub-neg73.3%
associate-+l+73.3%
*-commutative73.3%
+-commutative73.3%
*-commutative73.3%
sub-neg73.3%
+-commutative73.3%
associate--l+73.3%
distribute-lft-out--75.0%
distribute-rgt-out--81.7%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.2%
Final simplification95.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -9.5e+130) (not (<= d3 1.18e+188))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -9.5e+130) || !(d3 <= 1.18e+188)) {
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 <= (-9.5d+130)) .or. (.not. (d3 <= 1.18d+188))) 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 <= -9.5e+130) || !(d3 <= 1.18e+188)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -9.5e+130) or not (d3 <= 1.18e+188): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -9.5e+130) || !(d3 <= 1.18e+188)) 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 <= -9.5e+130) || ~((d3 <= 1.18e+188))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -9.5e+130], N[Not[LessEqual[d3, 1.18e+188]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -9.5 \cdot 10^{+130} \lor \neg \left(d3 \leq 1.18 \cdot 10^{+188}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -9.5000000000000009e130 or 1.18e188 < d3 Initial program 81.0%
sub-neg81.0%
associate-+l+81.0%
*-commutative81.0%
+-commutative81.0%
*-commutative81.0%
sub-neg81.0%
+-commutative81.0%
associate--l+81.0%
distribute-lft-out--86.2%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 82.3%
mul-1-neg82.3%
distribute-rgt-neg-out82.3%
Simplified82.3%
if -9.5000000000000009e130 < d3 < 1.18e188Initial program 89.9%
sub-neg89.9%
associate-+l+89.9%
*-commutative89.9%
+-commutative89.9%
*-commutative89.9%
sub-neg89.9%
+-commutative89.9%
associate--l+89.9%
distribute-lft-out--89.9%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.3%
Taylor expanded in d1 around 0 61.2%
+-commutative61.2%
Simplified61.2%
Final simplification66.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -8e+120) (* d1 d2) (if (<= d2 7.8e-122) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -8e+120) {
tmp = d1 * d2;
} else if (d2 <= 7.8e-122) {
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 <= (-8d+120)) then
tmp = d1 * d2
else if (d2 <= 7.8d-122) 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 <= -8e+120) {
tmp = d1 * d2;
} else if (d2 <= 7.8e-122) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -8e+120: tmp = d1 * d2 elif d2 <= 7.8e-122: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -8e+120) tmp = Float64(d1 * d2); elseif (d2 <= 7.8e-122) 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 <= -8e+120) tmp = d1 * d2; elseif (d2 <= 7.8e-122) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -8e+120], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, 7.8e-122], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -8 \cdot 10^{+120}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq 7.8 \cdot 10^{-122}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -7.9999999999999998e120Initial program 91.3%
sub-neg91.3%
associate-+l+91.3%
*-commutative91.3%
+-commutative91.3%
*-commutative91.3%
sub-neg91.3%
+-commutative91.3%
associate--l+91.3%
distribute-lft-out--91.3%
distribute-rgt-out--93.5%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 80.2%
if -7.9999999999999998e120 < d2 < 7.79999999999999979e-122Initial program 90.2%
sub-neg90.2%
associate-+l+90.2%
*-commutative90.2%
+-commutative90.2%
*-commutative90.2%
sub-neg90.2%
+-commutative90.2%
associate--l+90.2%
distribute-lft-out--91.0%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 41.2%
mul-1-neg41.2%
distribute-rgt-neg-out41.2%
Simplified41.2%
if 7.79999999999999979e-122 < d2 Initial program 83.7%
sub-neg83.7%
associate-+l+83.7%
*-commutative83.7%
+-commutative83.7%
*-commutative83.7%
sub-neg83.7%
+-commutative83.7%
associate--l+83.7%
distribute-lft-out--85.7%
distribute-rgt-out--89.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 28.5%
Final simplification43.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -6e+119) (* d1 (- (+ d2 d4) d3)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6e+119) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - d3) - 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 (d2 <= (-6d+119)) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * ((d4 - d3) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6e+119) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -6e+119: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -6e+119) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(Float64(d4 - d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -6e+119) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -6e+119], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -6 \cdot 10^{+119}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d2 < -6.00000000000000002e119Initial program 91.3%
sub-neg91.3%
associate-+l+91.3%
*-commutative91.3%
+-commutative91.3%
*-commutative91.3%
sub-neg91.3%
+-commutative91.3%
associate--l+91.3%
distribute-lft-out--91.3%
distribute-rgt-out--93.5%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in97.8%
associate--l-97.8%
*-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in d1 around 0 95.5%
+-commutative95.5%
Simplified95.5%
if -6.00000000000000002e119 < d2 Initial program 87.1%
sub-neg87.1%
associate-+l+87.1%
*-commutative87.1%
+-commutative87.1%
*-commutative87.1%
sub-neg87.1%
+-commutative87.1%
associate--l+87.1%
distribute-lft-out--88.5%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 89.3%
+-commutative89.3%
associate--r+89.3%
Simplified89.3%
Final simplification90.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 9e+84) (* d1 (- d2 d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 9e+84) {
tmp = d1 * (d2 - 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 <= 9d+84) then
tmp = d1 * (d2 - 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 <= 9e+84) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 9e+84: tmp = d1 * (d2 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 9e+84) tmp = Float64(d1 * Float64(d2 - 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 <= 9e+84) tmp = d1 * (d2 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 9e+84], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 9 \cdot 10^{+84}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 8.9999999999999994e84Initial program 89.4%
sub-neg89.4%
associate-+l+89.4%
*-commutative89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
distribute-lft-out--90.8%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in96.6%
associate--l-96.6%
*-commutative96.6%
Applied egg-rr96.6%
Taylor expanded in d1 around 0 74.3%
+-commutative74.3%
Simplified74.3%
Taylor expanded in d4 around 0 60.8%
if 8.9999999999999994e84 < d4 Initial program 81.3%
sub-neg81.3%
associate-+l+81.3%
*-commutative81.3%
+-commutative81.3%
*-commutative81.3%
sub-neg81.3%
+-commutative81.3%
associate--l+81.3%
distribute-lft-out--81.3%
distribute-rgt-out--85.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.5%
Taylor expanded in d1 around 0 77.0%
+-commutative77.0%
Simplified77.0%
Final simplification63.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.8e+99) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.8e+99) {
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 <= (-2.8d+99)) 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 <= -2.8e+99) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.8e+99: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.8e+99) 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 <= -2.8e+99) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.8e+99], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.8 \cdot 10^{+99}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -2.8e99Initial program 90.4%
sub-neg90.4%
associate-+l+90.4%
*-commutative90.4%
+-commutative90.4%
*-commutative90.4%
sub-neg90.4%
+-commutative90.4%
associate--l+90.4%
distribute-lft-out--90.4%
distribute-rgt-out--94.2%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 71.4%
if -2.8e99 < d2 Initial program 87.2%
sub-neg87.2%
associate-+l+87.2%
*-commutative87.2%
+-commutative87.2%
*-commutative87.2%
sub-neg87.2%
+-commutative87.2%
associate--l+87.2%
distribute-lft-out--88.7%
distribute-rgt-out--90.7%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 32.2%
Final simplification40.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 87.9%
sub-neg87.9%
associate-+l+87.9%
*-commutative87.9%
+-commutative87.9%
*-commutative87.9%
sub-neg87.9%
+-commutative87.9%
associate--l+87.9%
distribute-lft-out--89.0%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.0%
Final simplification30.0%
(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 2024026
(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)))