
(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 (- (- 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.8%
sub-neg87.8%
associate-+l+87.8%
*-commutative87.8%
+-commutative87.8%
*-commutative87.8%
sub-neg87.8%
+-commutative87.8%
associate--l+87.8%
distribute-lft-out--89.8%
distribute-rgt-out--92.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%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d3))) (t_1 (* d1 (- d2 d1))) (t_2 (* d1 (+ d2 d4))))
(if (<= d3 -1.8e+173)
(* d1 (- d2 d3))
(if (<= d3 -1.8e+92)
t_2
(if (<= d3 -3.7e+25)
t_0
(if (<= d3 -2.05e-60)
t_2
(if (<= d3 -8.6e-135)
t_1
(if (<= d3 4.6e-257) t_2 (if (<= d3 1.1e+59) t_1 t_0)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double t_1 = d1 * (d2 - d1);
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.8e+173) {
tmp = d1 * (d2 - d3);
} else if (d3 <= -1.8e+92) {
tmp = t_2;
} else if (d3 <= -3.7e+25) {
tmp = t_0;
} else if (d3 <= -2.05e-60) {
tmp = t_2;
} else if (d3 <= -8.6e-135) {
tmp = t_1;
} else if (d3 <= 4.6e-257) {
tmp = t_2;
} else if (d3 <= 1.1e+59) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d1 * (d4 - d3)
t_1 = d1 * (d2 - d1)
t_2 = d1 * (d2 + d4)
if (d3 <= (-1.8d+173)) then
tmp = d1 * (d2 - d3)
else if (d3 <= (-1.8d+92)) then
tmp = t_2
else if (d3 <= (-3.7d+25)) then
tmp = t_0
else if (d3 <= (-2.05d-60)) then
tmp = t_2
else if (d3 <= (-8.6d-135)) then
tmp = t_1
else if (d3 <= 4.6d-257) then
tmp = t_2
else if (d3 <= 1.1d+59) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double t_1 = d1 * (d2 - d1);
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.8e+173) {
tmp = d1 * (d2 - d3);
} else if (d3 <= -1.8e+92) {
tmp = t_2;
} else if (d3 <= -3.7e+25) {
tmp = t_0;
} else if (d3 <= -2.05e-60) {
tmp = t_2;
} else if (d3 <= -8.6e-135) {
tmp = t_1;
} else if (d3 <= 4.6e-257) {
tmp = t_2;
} else if (d3 <= 1.1e+59) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d3) t_1 = d1 * (d2 - d1) t_2 = d1 * (d2 + d4) tmp = 0 if d3 <= -1.8e+173: tmp = d1 * (d2 - d3) elif d3 <= -1.8e+92: tmp = t_2 elif d3 <= -3.7e+25: tmp = t_0 elif d3 <= -2.05e-60: tmp = t_2 elif d3 <= -8.6e-135: tmp = t_1 elif d3 <= 4.6e-257: tmp = t_2 elif d3 <= 1.1e+59: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d3)) t_1 = Float64(d1 * Float64(d2 - d1)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -1.8e+173) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= -1.8e+92) tmp = t_2; elseif (d3 <= -3.7e+25) tmp = t_0; elseif (d3 <= -2.05e-60) tmp = t_2; elseif (d3 <= -8.6e-135) tmp = t_1; elseif (d3 <= 4.6e-257) tmp = t_2; elseif (d3 <= 1.1e+59) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d3); t_1 = d1 * (d2 - d1); t_2 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -1.8e+173) tmp = d1 * (d2 - d3); elseif (d3 <= -1.8e+92) tmp = t_2; elseif (d3 <= -3.7e+25) tmp = t_0; elseif (d3 <= -2.05e-60) tmp = t_2; elseif (d3 <= -8.6e-135) tmp = t_1; elseif (d3 <= 4.6e-257) tmp = t_2; elseif (d3 <= 1.1e+59) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.8e+173], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, -1.8e+92], t$95$2, If[LessEqual[d3, -3.7e+25], t$95$0, If[LessEqual[d3, -2.05e-60], t$95$2, If[LessEqual[d3, -8.6e-135], t$95$1, If[LessEqual[d3, 4.6e-257], t$95$2, If[LessEqual[d3, 1.1e+59], t$95$1, t$95$0]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d3\right)\\
t_1 := d1 \cdot \left(d2 - d1\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -1.8 \cdot 10^{+173}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq -1.8 \cdot 10^{+92}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq -3.7 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq -2.05 \cdot 10^{-60}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq -8.6 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq 4.6 \cdot 10^{-257}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 1.1 \cdot 10^{+59}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -1.8000000000000001e173Initial program 64.2%
sub-neg64.2%
associate-+l+64.2%
*-commutative64.2%
+-commutative64.2%
*-commutative64.2%
sub-neg64.2%
+-commutative64.2%
associate--l+64.2%
distribute-lft-out--78.6%
distribute-rgt-out--82.1%
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-in85.7%
associate--l-85.7%
*-commutative85.7%
Applied egg-rr85.7%
Taylor expanded in d4 around 0 96.1%
Taylor expanded in d1 around 0 85.4%
if -1.8000000000000001e173 < d3 < -1.8e92 or -3.6999999999999999e25 < d3 < -2.05000000000000006e-60 or -8.59999999999999997e-135 < d3 < 4.6e-257Initial program 89.5%
sub-neg89.5%
associate-+l+89.5%
*-commutative89.5%
+-commutative89.5%
*-commutative89.5%
sub-neg89.5%
+-commutative89.5%
associate--l+89.5%
distribute-lft-out--89.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 d1 around 0 85.1%
Taylor expanded in d3 around 0 82.2%
+-commutative82.2%
Simplified82.2%
if -1.8e92 < d3 < -3.6999999999999999e25 or 1.1e59 < d3 Initial program 88.8%
sub-neg88.8%
associate-+l+88.8%
*-commutative88.8%
+-commutative88.8%
*-commutative88.8%
sub-neg88.8%
+-commutative88.8%
associate--l+88.8%
distribute-lft-out--90.4%
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 d1 around 0 93.6%
Taylor expanded in d2 around 0 73.5%
if -2.05000000000000006e-60 < d3 < -8.59999999999999997e-135 or 4.6e-257 < d3 < 1.1e59Initial program 92.8%
sub-neg92.8%
associate-+l+92.8%
*-commutative92.8%
+-commutative92.8%
*-commutative92.8%
sub-neg92.8%
+-commutative92.8%
associate--l+92.8%
distribute-lft-out--92.8%
distribute-rgt-out--95.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%
associate--r-100.0%
distribute-rgt-in95.9%
associate--l-95.9%
*-commutative95.9%
Applied egg-rr95.9%
Taylor expanded in d4 around 0 74.8%
Taylor expanded in d3 around 0 72.4%
Final simplification76.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d3))))
(if (<= d2 -5.8e+128)
(* d1 (- d2 d3))
(if (<= d2 -5.5e+51)
t_0
(if (<= d2 -9e+32)
(* d1 (- d2 d1))
(if (or (<= d2 -2.1e-38) (not (<= d2 2.9e-202)))
t_0
(* (+ d1 d3) (- d1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double tmp;
if (d2 <= -5.8e+128) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -5.5e+51) {
tmp = t_0;
} else if (d2 <= -9e+32) {
tmp = d1 * (d2 - d1);
} else if ((d2 <= -2.1e-38) || !(d2 <= 2.9e-202)) {
tmp = t_0;
} else {
tmp = (d1 + 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) :: t_0
real(8) :: tmp
t_0 = d1 * (d4 - d3)
if (d2 <= (-5.8d+128)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-5.5d+51)) then
tmp = t_0
else if (d2 <= (-9d+32)) then
tmp = d1 * (d2 - d1)
else if ((d2 <= (-2.1d-38)) .or. (.not. (d2 <= 2.9d-202))) then
tmp = t_0
else
tmp = (d1 + d3) * -d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double tmp;
if (d2 <= -5.8e+128) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -5.5e+51) {
tmp = t_0;
} else if (d2 <= -9e+32) {
tmp = d1 * (d2 - d1);
} else if ((d2 <= -2.1e-38) || !(d2 <= 2.9e-202)) {
tmp = t_0;
} else {
tmp = (d1 + d3) * -d1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d3) tmp = 0 if d2 <= -5.8e+128: tmp = d1 * (d2 - d3) elif d2 <= -5.5e+51: tmp = t_0 elif d2 <= -9e+32: tmp = d1 * (d2 - d1) elif (d2 <= -2.1e-38) or not (d2 <= 2.9e-202): tmp = t_0 else: tmp = (d1 + d3) * -d1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d3)) tmp = 0.0 if (d2 <= -5.8e+128) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -5.5e+51) tmp = t_0; elseif (d2 <= -9e+32) tmp = Float64(d1 * Float64(d2 - d1)); elseif ((d2 <= -2.1e-38) || !(d2 <= 2.9e-202)) tmp = t_0; else tmp = Float64(Float64(d1 + d3) * Float64(-d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d3); tmp = 0.0; if (d2 <= -5.8e+128) tmp = d1 * (d2 - d3); elseif (d2 <= -5.5e+51) tmp = t_0; elseif (d2 <= -9e+32) tmp = d1 * (d2 - d1); elseif ((d2 <= -2.1e-38) || ~((d2 <= 2.9e-202))) tmp = t_0; else tmp = (d1 + d3) * -d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -5.8e+128], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -5.5e+51], t$95$0, If[LessEqual[d2, -9e+32], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d2, -2.1e-38], N[Not[LessEqual[d2, 2.9e-202]], $MachinePrecision]], t$95$0, N[(N[(d1 + d3), $MachinePrecision] * (-d1)), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d3\right)\\
\mathbf{if}\;d2 \leq -5.8 \cdot 10^{+128}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -5.5 \cdot 10^{+51}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -9 \cdot 10^{+32}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -2.1 \cdot 10^{-38} \lor \neg \left(d2 \leq 2.9 \cdot 10^{-202}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(d1 + d3\right) \cdot \left(-d1\right)\\
\end{array}
\end{array}
if d2 < -5.8000000000000001e128Initial program 91.7%
sub-neg91.7%
associate-+l+91.7%
*-commutative91.7%
+-commutative91.7%
*-commutative91.7%
sub-neg91.7%
+-commutative91.7%
associate--l+91.7%
distribute-lft-out--91.7%
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-in94.4%
associate--l-94.4%
*-commutative94.4%
Applied egg-rr94.4%
Taylor expanded in d4 around 0 88.0%
Taylor expanded in d1 around 0 82.4%
if -5.8000000000000001e128 < d2 < -5.5e51 or -9.0000000000000007e32 < d2 < -2.10000000000000013e-38 or 2.89999999999999988e-202 < d2 Initial program 86.2%
sub-neg86.2%
associate-+l+86.2%
*-commutative86.2%
+-commutative86.2%
*-commutative86.2%
sub-neg86.2%
+-commutative86.2%
associate--l+86.2%
distribute-lft-out--88.4%
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 d1 around 0 81.5%
Taylor expanded in d2 around 0 50.5%
if -5.5e51 < d2 < -9.0000000000000007e32Initial program 74.8%
sub-neg74.8%
associate-+l+74.8%
*-commutative74.8%
+-commutative74.8%
*-commutative74.8%
sub-neg74.8%
+-commutative74.8%
associate--l+74.8%
distribute-lft-out--74.8%
distribute-rgt-out--87.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-in100.0%
associate--l-100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in d4 around 0 100.0%
Taylor expanded in d3 around 0 88.4%
if -2.10000000000000013e-38 < d2 < 2.89999999999999988e-202Initial program 90.5%
sub-neg90.5%
associate-+l+90.5%
*-commutative90.5%
+-commutative90.5%
*-commutative90.5%
sub-neg90.5%
+-commutative90.5%
associate--l+90.5%
distribute-lft-out--93.2%
distribute-rgt-out--93.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%
associate--r-100.0%
distribute-rgt-in95.9%
associate--l-95.9%
*-commutative95.9%
Applied egg-rr95.9%
Taylor expanded in d4 around 0 80.3%
Taylor expanded in d2 around 0 80.3%
mul-1-neg80.3%
distribute-rgt-neg-out80.3%
distribute-neg-in80.3%
+-commutative80.3%
sub-neg80.3%
Simplified80.3%
Final simplification64.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d3))) (t_2 (* d1 (+ d2 d4))))
(if (<= d3 -1.95e+180)
t_1
(if (<= d3 -2.6e-59)
t_2
(if (<= d3 -8.6e-135)
t_0
(if (<= d3 3.15e-251) t_2 (if (<= d3 5.1e+64) t_0 t_1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.95e+180) {
tmp = t_1;
} else if (d3 <= -2.6e-59) {
tmp = t_2;
} else if (d3 <= -8.6e-135) {
tmp = t_0;
} else if (d3 <= 3.15e-251) {
tmp = t_2;
} else if (d3 <= 5.1e+64) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * -d3
t_2 = d1 * (d2 + d4)
if (d3 <= (-1.95d+180)) then
tmp = t_1
else if (d3 <= (-2.6d-59)) then
tmp = t_2
else if (d3 <= (-8.6d-135)) then
tmp = t_0
else if (d3 <= 3.15d-251) then
tmp = t_2
else if (d3 <= 5.1d+64) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.95e+180) {
tmp = t_1;
} else if (d3 <= -2.6e-59) {
tmp = t_2;
} else if (d3 <= -8.6e-135) {
tmp = t_0;
} else if (d3 <= 3.15e-251) {
tmp = t_2;
} else if (d3 <= 5.1e+64) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * -d3 t_2 = d1 * (d2 + d4) tmp = 0 if d3 <= -1.95e+180: tmp = t_1 elif d3 <= -2.6e-59: tmp = t_2 elif d3 <= -8.6e-135: tmp = t_0 elif d3 <= 3.15e-251: tmp = t_2 elif d3 <= 5.1e+64: tmp = t_0 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(-d3)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -1.95e+180) tmp = t_1; elseif (d3 <= -2.6e-59) tmp = t_2; elseif (d3 <= -8.6e-135) tmp = t_0; elseif (d3 <= 3.15e-251) tmp = t_2; elseif (d3 <= 5.1e+64) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * -d3; t_2 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -1.95e+180) tmp = t_1; elseif (d3 <= -2.6e-59) tmp = t_2; elseif (d3 <= -8.6e-135) tmp = t_0; elseif (d3 <= 3.15e-251) tmp = t_2; elseif (d3 <= 5.1e+64) tmp = t_0; else tmp = t_1; 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 * (-d3)), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.95e+180], t$95$1, If[LessEqual[d3, -2.6e-59], t$95$2, If[LessEqual[d3, -8.6e-135], t$95$0, If[LessEqual[d3, 3.15e-251], t$95$2, If[LessEqual[d3, 5.1e+64], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -1.95 \cdot 10^{+180}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq -2.6 \cdot 10^{-59}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq -8.6 \cdot 10^{-135}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 3.15 \cdot 10^{-251}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 5.1 \cdot 10^{+64}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d3 < -1.95e180 or 5.10000000000000024e64 < d3 Initial program 79.7%
sub-neg79.7%
associate-+l+79.7%
*-commutative79.7%
+-commutative79.7%
*-commutative79.7%
sub-neg79.7%
+-commutative79.7%
associate--l+79.7%
distribute-lft-out--86.5%
distribute-rgt-out--89.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 d3 around inf 73.9%
mul-1-neg73.9%
distribute-lft-neg-in73.9%
*-commutative73.9%
Simplified73.9%
if -1.95e180 < d3 < -2.59999999999999998e-59 or -8.59999999999999997e-135 < d3 < 3.1499999999999999e-251Initial 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--90.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 d1 around 0 84.5%
Taylor expanded in d3 around 0 73.5%
+-commutative73.5%
Simplified73.5%
if -2.59999999999999998e-59 < d3 < -8.59999999999999997e-135 or 3.1499999999999999e-251 < d3 < 5.10000000000000024e64Initial program 92.8%
sub-neg92.8%
associate-+l+92.8%
*-commutative92.8%
+-commutative92.8%
*-commutative92.8%
sub-neg92.8%
+-commutative92.8%
associate--l+92.8%
distribute-lft-out--92.8%
distribute-rgt-out--95.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%
associate--r-100.0%
distribute-rgt-in95.9%
associate--l-95.9%
*-commutative95.9%
Applied egg-rr95.9%
Taylor expanded in d4 around 0 74.8%
Taylor expanded in d3 around 0 72.4%
Final simplification73.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))) (t_2 (* d1 (+ d2 d4))))
(if (<= d3 -1.8e+173)
t_1
(if (<= d3 -5.7e-59)
t_2
(if (<= d3 -8e-135)
t_0
(if (<= d3 3.2e-255) t_2 (if (<= d3 5.7e+63) t_0 t_1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.8e+173) {
tmp = t_1;
} else if (d3 <= -5.7e-59) {
tmp = t_2;
} else if (d3 <= -8e-135) {
tmp = t_0;
} else if (d3 <= 3.2e-255) {
tmp = t_2;
} else if (d3 <= 5.7e+63) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
t_2 = d1 * (d2 + d4)
if (d3 <= (-1.8d+173)) then
tmp = t_1
else if (d3 <= (-5.7d-59)) then
tmp = t_2
else if (d3 <= (-8d-135)) then
tmp = t_0
else if (d3 <= 3.2d-255) then
tmp = t_2
else if (d3 <= 5.7d+63) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -1.8e+173) {
tmp = t_1;
} else if (d3 <= -5.7e-59) {
tmp = t_2;
} else if (d3 <= -8e-135) {
tmp = t_0;
} else if (d3 <= 3.2e-255) {
tmp = t_2;
} else if (d3 <= 5.7e+63) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) t_2 = d1 * (d2 + d4) tmp = 0 if d3 <= -1.8e+173: tmp = t_1 elif d3 <= -5.7e-59: tmp = t_2 elif d3 <= -8e-135: tmp = t_0 elif d3 <= 3.2e-255: tmp = t_2 elif d3 <= 5.7e+63: tmp = t_0 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -1.8e+173) tmp = t_1; elseif (d3 <= -5.7e-59) tmp = t_2; elseif (d3 <= -8e-135) tmp = t_0; elseif (d3 <= 3.2e-255) tmp = t_2; elseif (d3 <= 5.7e+63) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); t_2 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -1.8e+173) tmp = t_1; elseif (d3 <= -5.7e-59) tmp = t_2; elseif (d3 <= -8e-135) tmp = t_0; elseif (d3 <= 3.2e-255) tmp = t_2; elseif (d3 <= 5.7e+63) tmp = t_0; else tmp = t_1; 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[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.8e+173], t$95$1, If[LessEqual[d3, -5.7e-59], t$95$2, If[LessEqual[d3, -8e-135], t$95$0, If[LessEqual[d3, 3.2e-255], t$95$2, If[LessEqual[d3, 5.7e+63], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -1.8 \cdot 10^{+173}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq -5.7 \cdot 10^{-59}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq -8 \cdot 10^{-135}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 3.2 \cdot 10^{-255}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 5.7 \cdot 10^{+63}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d3 < -1.8000000000000001e173 or 5.7000000000000002e63 < d3 Initial program 79.2%
sub-neg79.2%
associate-+l+79.2%
*-commutative79.2%
+-commutative79.2%
*-commutative79.2%
sub-neg79.2%
+-commutative79.2%
associate--l+79.2%
distribute-lft-out--85.7%
distribute-rgt-out--88.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%
associate--r-100.0%
distribute-rgt-in93.4%
associate--l-93.4%
*-commutative93.4%
Applied egg-rr93.4%
Taylor expanded in d4 around 0 96.0%
Taylor expanded in d1 around 0 86.9%
if -1.8000000000000001e173 < d3 < -5.7e-59 or -8.0000000000000003e-135 < d3 < 3.19999999999999993e-255Initial 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--90.1%
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 d1 around 0 85.2%
Taylor expanded in d3 around 0 74.9%
+-commutative74.9%
Simplified74.9%
if -5.7e-59 < d3 < -8.0000000000000003e-135 or 3.19999999999999993e-255 < d3 < 5.7000000000000002e63Initial program 92.8%
sub-neg92.8%
associate-+l+92.8%
*-commutative92.8%
+-commutative92.8%
*-commutative92.8%
sub-neg92.8%
+-commutative92.8%
associate--l+92.8%
distribute-lft-out--92.8%
distribute-rgt-out--95.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%
associate--r-100.0%
distribute-rgt-in95.9%
associate--l-95.9%
*-commutative95.9%
Applied egg-rr95.9%
Taylor expanded in d4 around 0 74.8%
Taylor expanded in d3 around 0 72.4%
Final simplification77.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -4.1e-221)
(* d1 d2)
(if (or (<= d4 1250.0) (and (not (<= d4 2.7e+61)) (<= d4 1.4e+112)))
(* d1 (- d3))
(* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -4.1e-221) {
tmp = d1 * d2;
} else if ((d4 <= 1250.0) || (!(d4 <= 2.7e+61) && (d4 <= 1.4e+112))) {
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 (d4 <= (-4.1d-221)) then
tmp = d1 * d2
else if ((d4 <= 1250.0d0) .or. (.not. (d4 <= 2.7d+61)) .and. (d4 <= 1.4d+112)) 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 (d4 <= -4.1e-221) {
tmp = d1 * d2;
} else if ((d4 <= 1250.0) || (!(d4 <= 2.7e+61) && (d4 <= 1.4e+112))) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -4.1e-221: tmp = d1 * d2 elif (d4 <= 1250.0) or (not (d4 <= 2.7e+61) and (d4 <= 1.4e+112)): tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -4.1e-221) tmp = Float64(d1 * d2); elseif ((d4 <= 1250.0) || (!(d4 <= 2.7e+61) && (d4 <= 1.4e+112))) 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 (d4 <= -4.1e-221) tmp = d1 * d2; elseif ((d4 <= 1250.0) || (~((d4 <= 2.7e+61)) && (d4 <= 1.4e+112))) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -4.1e-221], N[(d1 * d2), $MachinePrecision], If[Or[LessEqual[d4, 1250.0], And[N[Not[LessEqual[d4, 2.7e+61]], $MachinePrecision], LessEqual[d4, 1.4e+112]]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -4.1 \cdot 10^{-221}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1250 \lor \neg \left(d4 \leq 2.7 \cdot 10^{+61}\right) \land d4 \leq 1.4 \cdot 10^{+112}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -4.09999999999999981e-221Initial program 86.0%
sub-neg86.0%
associate-+l+86.0%
*-commutative86.0%
+-commutative86.0%
*-commutative86.0%
sub-neg86.0%
+-commutative86.0%
associate--l+86.0%
distribute-lft-out--89.5%
distribute-rgt-out--92.1%
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 31.0%
if -4.09999999999999981e-221 < d4 < 1250 or 2.7000000000000002e61 < d4 < 1.4000000000000001e112Initial program 91.2%
sub-neg91.2%
associate-+l+91.2%
*-commutative91.2%
+-commutative91.2%
*-commutative91.2%
sub-neg91.2%
+-commutative91.2%
associate--l+91.2%
distribute-lft-out--91.2%
distribute-rgt-out--92.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 inf 36.7%
mul-1-neg36.7%
distribute-lft-neg-in36.7%
*-commutative36.7%
Simplified36.7%
if 1250 < d4 < 2.7000000000000002e61 or 1.4000000000000001e112 < d4 Initial program 86.0%
sub-neg86.0%
associate-+l+86.0%
*-commutative86.0%
+-commutative86.0%
*-commutative86.0%
sub-neg86.0%
+-commutative86.0%
associate--l+86.0%
distribute-lft-out--88.0%
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 d4 around inf 63.1%
Final simplification39.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d4 1420.0) (and (not (<= d4 8e+60)) (<= d4 4e+123))) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d4 <= 1420.0) || (!(d4 <= 8e+60) && (d4 <= 4e+123))) {
tmp = d1 * (d2 - (d1 + 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 ((d4 <= 1420.0d0) .or. (.not. (d4 <= 8d+60)) .and. (d4 <= 4d+123)) then
tmp = d1 * (d2 - (d1 + 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 ((d4 <= 1420.0) || (!(d4 <= 8e+60) && (d4 <= 4e+123))) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d4 <= 1420.0) or (not (d4 <= 8e+60) and (d4 <= 4e+123)): tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d4 <= 1420.0) || (!(d4 <= 8e+60) && (d4 <= 4e+123))) tmp = Float64(d1 * Float64(d2 - Float64(d1 + 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 ((d4 <= 1420.0) || (~((d4 <= 8e+60)) && (d4 <= 4e+123))) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d4, 1420.0], And[N[Not[LessEqual[d4, 8e+60]], $MachinePrecision], LessEqual[d4, 4e+123]]], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1420 \lor \neg \left(d4 \leq 8 \cdot 10^{+60}\right) \land d4 \leq 4 \cdot 10^{+123}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d4 < 1420 or 7.9999999999999996e60 < d4 < 3.99999999999999991e123Initial program 88.4%
sub-neg88.4%
associate-+l+88.4%
*-commutative88.4%
+-commutative88.4%
*-commutative88.4%
sub-neg88.4%
+-commutative88.4%
associate--l+88.4%
distribute-lft-out--90.3%
distribute-rgt-out--92.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%
associate--r-100.0%
distribute-rgt-in95.1%
associate--l-95.1%
*-commutative95.1%
Applied egg-rr95.1%
Taylor expanded in d4 around 0 87.2%
if 1420 < d4 < 7.9999999999999996e60 or 3.99999999999999991e123 < d4 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--87.7%
distribute-rgt-out--91.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 90.2%
Final simplification87.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 (+ d1 d3)))))
(if (<= d4 2e+18)
t_0
(if (<= d4 4.2e+46)
(* d1 (- d4 d1))
(if (<= d4 2.8e+120) t_0 (* d1 (- d4 d3)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - (d1 + d3));
double tmp;
if (d4 <= 2e+18) {
tmp = t_0;
} else if (d4 <= 4.2e+46) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 2.8e+120) {
tmp = t_0;
} 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 - (d1 + d3))
if (d4 <= 2d+18) then
tmp = t_0
else if (d4 <= 4.2d+46) then
tmp = d1 * (d4 - d1)
else if (d4 <= 2.8d+120) then
tmp = t_0
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 - (d1 + d3));
double tmp;
if (d4 <= 2e+18) {
tmp = t_0;
} else if (d4 <= 4.2e+46) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 2.8e+120) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - (d1 + d3)) tmp = 0 if d4 <= 2e+18: tmp = t_0 elif d4 <= 4.2e+46: tmp = d1 * (d4 - d1) elif d4 <= 2.8e+120: tmp = t_0 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - Float64(d1 + d3))) tmp = 0.0 if (d4 <= 2e+18) tmp = t_0; elseif (d4 <= 4.2e+46) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d4 <= 2.8e+120) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - (d1 + d3)); tmp = 0.0; if (d4 <= 2e+18) tmp = t_0; elseif (d4 <= 4.2e+46) tmp = d1 * (d4 - d1); elseif (d4 <= 2.8e+120) tmp = t_0; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 2e+18], t$95$0, If[LessEqual[d4, 4.2e+46], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 2.8e+120], t$95$0, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{if}\;d4 \leq 2 \cdot 10^{+18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{+46}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d4 \leq 2.8 \cdot 10^{+120}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 2e18 or 4.2e46 < d4 < 2.8000000000000001e120Initial program 88.1%
sub-neg88.1%
associate-+l+88.1%
*-commutative88.1%
+-commutative88.1%
*-commutative88.1%
sub-neg88.1%
+-commutative88.1%
associate--l+88.1%
distribute-lft-out--90.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%
associate--r-100.0%
distribute-rgt-in95.2%
associate--l-95.2%
*-commutative95.2%
Applied egg-rr95.2%
Taylor expanded in d4 around 0 87.0%
if 2e18 < d4 < 4.2e46Initial 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%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d2 around 0 76.0%
if 2.8000000000000001e120 < d4 Initial program 85.4%
sub-neg85.4%
associate-+l+85.4%
*-commutative85.4%
+-commutative85.4%
*-commutative85.4%
sub-neg85.4%
+-commutative85.4%
associate--l+85.4%
distribute-lft-out--87.8%
distribute-rgt-out--92.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 d1 around 0 93.0%
Taylor expanded in d2 around 0 84.3%
Final simplification86.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 4.5e-152)
t_0
(if (<= d4 4.1e-17)
(* d1 (- d2 d1))
(if (<= d4 1.6e+17) t_0 (* d1 (- d4 d1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 4.5e-152) {
tmp = t_0;
} else if (d4 <= 4.1e-17) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.6e+17) {
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 * (d2 - d3)
if (d4 <= 4.5d-152) then
tmp = t_0
else if (d4 <= 4.1d-17) then
tmp = d1 * (d2 - d1)
else if (d4 <= 1.6d+17) 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 * (d2 - d3);
double tmp;
if (d4 <= 4.5e-152) {
tmp = t_0;
} else if (d4 <= 4.1e-17) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.6e+17) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 4.5e-152: tmp = t_0 elif d4 <= 4.1e-17: tmp = d1 * (d2 - d1) elif d4 <= 1.6e+17: tmp = t_0 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 4.5e-152) tmp = t_0; elseif (d4 <= 4.1e-17) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 1.6e+17) 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 * (d2 - d3); tmp = 0.0; if (d4 <= 4.5e-152) tmp = t_0; elseif (d4 <= 4.1e-17) tmp = d1 * (d2 - d1); elseif (d4 <= 1.6e+17) 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[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 4.5e-152], t$95$0, If[LessEqual[d4, 4.1e-17], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.6e+17], t$95$0, N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 4.5 \cdot 10^{-152}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 4.1 \cdot 10^{-17}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 1.6 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < 4.5000000000000004e-152 or 4.1000000000000001e-17 < d4 < 1.6e17Initial 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.9%
distribute-rgt-out--92.1%
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-in94.9%
associate--l-94.9%
*-commutative94.9%
Applied egg-rr94.9%
Taylor expanded in d4 around 0 85.7%
Taylor expanded in d1 around 0 62.1%
if 4.5000000000000004e-152 < d4 < 4.1000000000000001e-17Initial program 95.2%
sub-neg95.2%
associate-+l+95.2%
*-commutative95.2%
+-commutative95.2%
*-commutative95.2%
sub-neg95.2%
+-commutative95.2%
associate--l+95.2%
distribute-lft-out--95.2%
distribute-rgt-out--95.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%
associate--r-100.0%
distribute-rgt-in100.0%
associate--l-100.0%
*-commutative100.0%
Applied egg-rr100.0%
Taylor expanded in d4 around 0 92.1%
Taylor expanded in d3 around 0 72.4%
if 1.6e17 < d4 Initial program 86.0%
sub-neg86.0%
associate-+l+86.0%
*-commutative86.0%
+-commutative86.0%
*-commutative86.0%
sub-neg86.0%
+-commutative86.0%
associate--l+86.0%
distribute-lft-out--87.7%
distribute-rgt-out--91.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 d3 around 0 84.7%
Taylor expanded in d2 around 0 70.0%
Final simplification64.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -2.4e-33) (not (<= d3 6.5e+56))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.4e-33) || !(d3 <= 6.5e+56)) {
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 <= (-2.4d-33)) .or. (.not. (d3 <= 6.5d+56))) 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 <= -2.4e-33) || !(d3 <= 6.5e+56)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -2.4e-33) or not (d3 <= 6.5e+56): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -2.4e-33) || !(d3 <= 6.5e+56)) 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 <= -2.4e-33) || ~((d3 <= 6.5e+56))) 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, -2.4e-33], N[Not[LessEqual[d3, 6.5e+56]], $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 -2.4 \cdot 10^{-33} \lor \neg \left(d3 \leq 6.5 \cdot 10^{+56}\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 < -2.4e-33 or 6.5000000000000001e56 < d3 Initial program 82.3%
sub-neg82.3%
associate-+l+82.3%
*-commutative82.3%
+-commutative82.3%
*-commutative82.3%
sub-neg82.3%
+-commutative82.3%
associate--l+82.3%
distribute-lft-out--86.5%
distribute-rgt-out--88.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 d1 around 0 91.9%
if -2.4e-33 < d3 < 6.5000000000000001e56Initial program 92.7%
sub-neg92.7%
associate-+l+92.7%
*-commutative92.7%
+-commutative92.7%
*-commutative92.7%
sub-neg92.7%
+-commutative92.7%
associate--l+92.7%
distribute-lft-out--92.7%
distribute-rgt-out--95.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 98.3%
Final simplification95.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.95e+180) (not (<= d3 7.5e+130))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.95e+180) || !(d3 <= 7.5e+130)) {
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.95d+180)) .or. (.not. (d3 <= 7.5d+130))) 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.95e+180) || !(d3 <= 7.5e+130)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.95e+180) or not (d3 <= 7.5e+130): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.95e+180) || !(d3 <= 7.5e+130)) 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.95e+180) || ~((d3 <= 7.5e+130))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.95e+180], N[Not[LessEqual[d3, 7.5e+130]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.95 \cdot 10^{+180} \lor \neg \left(d3 \leq 7.5 \cdot 10^{+130}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.95e180 or 7.5000000000000003e130 < d3 Initial 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--83.0%
distribute-rgt-out--86.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 81.3%
mul-1-neg81.3%
distribute-lft-neg-in81.3%
*-commutative81.3%
Simplified81.3%
if -1.95e180 < d3 < 7.5000000000000003e130Initial 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.8%
distribute-rgt-out--93.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 d1 around 0 74.0%
Taylor expanded in d3 around 0 64.8%
+-commutative64.8%
Simplified64.8%
Final simplification68.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.9e-16) (* d1 (- d2 (+ d1 d3))) (* d1 (- (- d4 d1) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.9e-16) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 1.9d-16) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * ((d4 - d1) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.9e-16) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.9e-16: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.9e-16) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d4 - d1) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.9e-16) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.9e-16], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.9 \cdot 10^{-16}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 1.90000000000000006e-16Initial program 88.1%
sub-neg88.1%
associate-+l+88.1%
*-commutative88.1%
+-commutative88.1%
*-commutative88.1%
sub-neg88.1%
+-commutative88.1%
associate--l+88.1%
distribute-lft-out--90.2%
distribute-rgt-out--92.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%
associate--r-100.0%
distribute-rgt-in95.3%
associate--l-95.3%
*-commutative95.3%
Applied egg-rr95.3%
Taylor expanded in d4 around 0 86.5%
if 1.90000000000000006e-16 < d4 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.7%
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 d2 around 0 84.3%
associate--r+84.3%
Simplified84.3%
Final simplification86.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 0.23) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 0.23) {
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 <= 0.23d0) 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 <= 0.23) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 0.23: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 0.23) 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 <= 0.23) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 0.23], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 0.23:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 0.23000000000000001Initial program 88.3%
sub-neg88.3%
associate-+l+88.3%
*-commutative88.3%
+-commutative88.3%
*-commutative88.3%
sub-neg88.3%
+-commutative88.3%
associate--l+88.3%
distribute-lft-out--90.3%
distribute-rgt-out--92.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 35.7%
if 0.23000000000000001 < d4 Initial program 86.4%
sub-neg86.4%
associate-+l+86.4%
*-commutative86.4%
+-commutative86.4%
*-commutative86.4%
sub-neg86.4%
+-commutative86.4%
associate--l+86.4%
distribute-lft-out--88.1%
distribute-rgt-out--91.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 inf 53.9%
Final simplification39.9%
(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.8%
sub-neg87.8%
associate-+l+87.8%
*-commutative87.8%
+-commutative87.8%
*-commutative87.8%
sub-neg87.8%
+-commutative87.8%
associate--l+87.8%
distribute-lft-out--89.8%
distribute-rgt-out--92.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 31.2%
Final simplification31.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 2024029
(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)))