
(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(Float64(d4 - d3) - 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[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision] + d2), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d4 - d3\right) - d1\right) + d2\right)
\end{array}
Initial program 90.2%
associate--l+90.2%
sub-neg90.2%
associate-+l+90.2%
+-commutative90.2%
--rgt-identity90.2%
associate--r-90.2%
associate-+r-90.2%
+-commutative90.2%
*-commutative90.2%
sub-neg90.2%
distribute-lft-out--90.6%
distribute-lft-out--96.1%
neg-sub096.1%
distribute-rgt-neg-out96.1%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -1.05e+72)
t_0
(if (<= d3 -4.8e-136)
t_1
(if (<= d3 10.0) (* d1 (- d2 d1)) (if (<= d3 2e+99) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -1.05e+72) {
tmp = t_0;
} else if (d3 <= -4.8e-136) {
tmp = t_1;
} else if (d3 <= 10.0) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 2e+99) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * -d3
t_1 = d1 * (d4 + d2)
if (d3 <= (-1.05d+72)) then
tmp = t_0
else if (d3 <= (-4.8d-136)) then
tmp = t_1
else if (d3 <= 10.0d0) then
tmp = d1 * (d2 - d1)
else if (d3 <= 2d+99) 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 * -d3;
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -1.05e+72) {
tmp = t_0;
} else if (d3 <= -4.8e-136) {
tmp = t_1;
} else if (d3 <= 10.0) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 2e+99) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * (d4 + d2) tmp = 0 if d3 <= -1.05e+72: tmp = t_0 elif d3 <= -4.8e-136: tmp = t_1 elif d3 <= 10.0: tmp = d1 * (d2 - d1) elif d3 <= 2e+99: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) t_1 = Float64(d1 * Float64(d4 + d2)) tmp = 0.0 if (d3 <= -1.05e+72) tmp = t_0; elseif (d3 <= -4.8e-136) tmp = t_1; elseif (d3 <= 10.0) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 2e+99) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; t_1 = d1 * (d4 + d2); tmp = 0.0; if (d3 <= -1.05e+72) tmp = t_0; elseif (d3 <= -4.8e-136) tmp = t_1; elseif (d3 <= 10.0) tmp = d1 * (d2 - d1); elseif (d3 <= 2e+99) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1.05e+72], t$95$0, If[LessEqual[d3, -4.8e-136], t$95$1, If[LessEqual[d3, 10.0], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2e+99], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d4 + d2\right)\\
\mathbf{if}\;d3 \leq -1.05 \cdot 10^{+72}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -4.8 \cdot 10^{-136}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 10:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 2 \cdot 10^{+99}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -1.0500000000000001e72 or 1.9999999999999999e99 < d3 Initial program 83.1%
associate--l+83.1%
sub-neg83.1%
associate-+l+83.1%
+-commutative83.1%
--rgt-identity83.1%
associate--r-83.1%
associate-+r-83.1%
+-commutative83.1%
*-commutative83.1%
sub-neg83.1%
distribute-lft-out--84.2%
distribute-lft-out--94.7%
neg-sub094.7%
distribute-rgt-neg-out94.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 71.9%
mul-1-neg71.9%
distribute-lft-neg-in71.9%
*-commutative71.9%
Simplified71.9%
if -1.0500000000000001e72 < d3 < -4.7999999999999997e-136 or 10 < d3 < 1.9999999999999999e99Initial program 92.3%
associate--l+92.3%
sub-neg92.3%
associate-+l+92.3%
+-commutative92.3%
--rgt-identity92.3%
associate--r-92.3%
associate-+r-92.3%
+-commutative92.3%
*-commutative92.3%
sub-neg92.3%
distribute-lft-out--92.3%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.3%
Taylor expanded in d3 around 0 73.3%
if -4.7999999999999997e-136 < d3 < 10Initial program 95.8%
associate--l+95.8%
sub-neg95.8%
associate-+l+95.8%
+-commutative95.8%
--rgt-identity95.8%
associate--r-95.8%
associate-+r-95.8%
+-commutative95.8%
*-commutative95.8%
sub-neg95.8%
distribute-lft-out--95.8%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 75.4%
Taylor expanded in d3 around 0 74.2%
Final simplification73.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -5.7e+69)
t_0
(if (<= d3 -3.5e-137)
t_1
(if (<= d3 10.2) (* d1 (- d2 d1)) (if (<= d3 7e+96) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -5.7e+69) {
tmp = t_0;
} else if (d3 <= -3.5e-137) {
tmp = t_1;
} else if (d3 <= 10.2) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 7e+96) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * (d4 + d2)
if (d3 <= (-5.7d+69)) then
tmp = t_0
else if (d3 <= (-3.5d-137)) then
tmp = t_1
else if (d3 <= 10.2d0) then
tmp = d1 * (d2 - d1)
else if (d3 <= 7d+96) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -5.7e+69) {
tmp = t_0;
} else if (d3 <= -3.5e-137) {
tmp = t_1;
} else if (d3 <= 10.2) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 7e+96) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d4 + d2) tmp = 0 if d3 <= -5.7e+69: tmp = t_0 elif d3 <= -3.5e-137: tmp = t_1 elif d3 <= 10.2: tmp = d1 * (d2 - d1) elif d3 <= 7e+96: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d4 + d2)) tmp = 0.0 if (d3 <= -5.7e+69) tmp = t_0; elseif (d3 <= -3.5e-137) tmp = t_1; elseif (d3 <= 10.2) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 7e+96) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d4 + d2); tmp = 0.0; if (d3 <= -5.7e+69) tmp = t_0; elseif (d3 <= -3.5e-137) tmp = t_1; elseif (d3 <= 10.2) tmp = d1 * (d2 - d1); elseif (d3 <= 7e+96) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -5.7e+69], t$95$0, If[LessEqual[d3, -3.5e-137], t$95$1, If[LessEqual[d3, 10.2], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 7e+96], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d4 + d2\right)\\
\mathbf{if}\;d3 \leq -5.7 \cdot 10^{+69}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -3.5 \cdot 10^{-137}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 10.2:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 7 \cdot 10^{+96}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -5.7e69 or 6.9999999999999998e96 < d3 Initial program 83.1%
associate--l+83.1%
sub-neg83.1%
associate-+l+83.1%
+-commutative83.1%
--rgt-identity83.1%
associate--r-83.1%
associate-+r-83.1%
+-commutative83.1%
*-commutative83.1%
sub-neg83.1%
distribute-lft-out--84.2%
distribute-lft-out--94.7%
neg-sub094.7%
distribute-rgt-neg-out94.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.5%
Taylor expanded in d1 around 0 79.4%
if -5.7e69 < d3 < -3.5000000000000001e-137 or 10.199999999999999 < d3 < 6.9999999999999998e96Initial program 92.3%
associate--l+92.3%
sub-neg92.3%
associate-+l+92.3%
+-commutative92.3%
--rgt-identity92.3%
associate--r-92.3%
associate-+r-92.3%
+-commutative92.3%
*-commutative92.3%
sub-neg92.3%
distribute-lft-out--92.3%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.3%
Taylor expanded in d3 around 0 73.3%
if -3.5000000000000001e-137 < d3 < 10.199999999999999Initial program 95.8%
associate--l+95.8%
sub-neg95.8%
associate-+l+95.8%
+-commutative95.8%
--rgt-identity95.8%
associate--r-95.8%
associate-+r-95.8%
+-commutative95.8%
*-commutative95.8%
sub-neg95.8%
distribute-lft-out--95.8%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 75.4%
Taylor expanded in d3 around 0 74.2%
Final simplification75.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -3.6e-24) (not (<= d3 5.3e+98))) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.6e-24) || !(d3 <= 5.3e+98)) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 + d2) - 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 <= (-3.6d-24)) .or. (.not. (d3 <= 5.3d+98))) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * ((d4 + d2) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.6e-24) || !(d3 <= 5.3e+98)) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -3.6e-24) or not (d3 <= 5.3e+98): tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -3.6e-24) || !(d3 <= 5.3e+98)) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -3.6e-24) || ~((d3 <= 5.3e+98))) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -3.6e-24], N[Not[LessEqual[d3, 5.3e+98]], $MachinePrecision]], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -3.6 \cdot 10^{-24} \lor \neg \left(d3 \leq 5.3 \cdot 10^{+98}\right):\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -3.6000000000000001e-24 or 5.29999999999999997e98 < d3 Initial program 86.5%
associate--l+86.5%
sub-neg86.5%
associate-+l+86.5%
+-commutative86.5%
--rgt-identity86.5%
associate--r-86.5%
associate-+r-86.5%
+-commutative86.5%
*-commutative86.5%
sub-neg86.5%
distribute-lft-out--87.4%
distribute-lft-out--95.8%
neg-sub095.8%
distribute-rgt-neg-out95.8%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.3%
if -3.6000000000000001e-24 < d3 < 5.29999999999999997e98Initial program 93.4%
associate--l+93.4%
sub-neg93.4%
associate-+l+93.4%
+-commutative93.4%
--rgt-identity93.4%
associate--r-93.4%
associate-+r-93.4%
+-commutative93.4%
*-commutative93.4%
sub-neg93.4%
distribute-lft-out--93.4%
distribute-lft-out--96.3%
neg-sub096.3%
distribute-rgt-neg-out96.3%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.0%
Final simplification91.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -3.3e+35) (not (<= d1 1.3e-35))) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d4 d2) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -3.3e+35) || !(d1 <= 1.3e-35)) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 + d2) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d1 <= (-3.3d+35)) .or. (.not. (d1 <= 1.3d-35))) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * ((d4 + d2) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -3.3e+35) || !(d1 <= 1.3e-35)) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d4 + d2) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -3.3e+35) or not (d1 <= 1.3e-35): tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d4 + d2) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -3.3e+35) || !(d1 <= 1.3e-35)) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -3.3e+35) || ~((d1 <= 1.3e-35))) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d4 + d2) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -3.3e+35], N[Not[LessEqual[d1, 1.3e-35]], $MachinePrecision]], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -3.3 \cdot 10^{+35} \lor \neg \left(d1 \leq 1.3 \cdot 10^{-35}\right):\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -3.3000000000000002e35 or 1.30000000000000002e-35 < d1 Initial program 79.0%
associate--l+79.0%
sub-neg79.0%
associate-+l+79.0%
+-commutative79.0%
--rgt-identity79.0%
associate--r-79.0%
associate-+r-79.0%
+-commutative79.0%
*-commutative79.0%
sub-neg79.0%
distribute-lft-out--79.8%
distribute-lft-out--91.6%
neg-sub091.6%
distribute-rgt-neg-out91.6%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 91.2%
if -3.3000000000000002e35 < d1 < 1.30000000000000002e-35Initial program 99.9%
associate--l+99.9%
sub-neg99.9%
associate-+l+99.9%
+-commutative99.9%
--rgt-identity99.9%
associate--r-99.9%
associate-+r-99.9%
+-commutative99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-out--100.0%
distribute-lft-out--100.0%
neg-sub0100.0%
distribute-rgt-neg-out100.0%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 97.4%
Final simplification94.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -9.4e+94) (* d1 (- d2 d3)) (if (<= d2 -1.05e-274) (* (+ d1 d3) (- d1)) (* d1 (- d4 d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -9.4e+94) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.05e-274) {
tmp = (d1 + d3) * -d1;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-9.4d+94)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-1.05d-274)) then
tmp = (d1 + d3) * -d1
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -9.4e+94) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.05e-274) {
tmp = (d1 + d3) * -d1;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -9.4e+94: tmp = d1 * (d2 - d3) elif d2 <= -1.05e-274: tmp = (d1 + d3) * -d1 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -9.4e+94) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -1.05e-274) tmp = Float64(Float64(d1 + d3) * Float64(-d1)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -9.4e+94) tmp = d1 * (d2 - d3); elseif (d2 <= -1.05e-274) tmp = (d1 + d3) * -d1; else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -9.4e+94], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -1.05e-274], N[(N[(d1 + d3), $MachinePrecision] * (-d1)), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -9.4 \cdot 10^{+94}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -1.05 \cdot 10^{-274}:\\
\;\;\;\;\left(d1 + d3\right) \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -9.40000000000000034e94Initial program 82.9%
associate--l+82.9%
sub-neg82.9%
associate-+l+82.9%
+-commutative82.9%
--rgt-identity82.9%
associate--r-82.9%
associate-+r-82.9%
+-commutative82.9%
*-commutative82.9%
sub-neg82.9%
distribute-lft-out--82.9%
distribute-lft-out--87.2%
neg-sub087.2%
distribute-rgt-neg-out87.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 87.8%
Taylor expanded in d1 around 0 79.3%
if -9.40000000000000034e94 < d2 < -1.04999999999999997e-274Initial program 95.1%
associate--l+95.1%
sub-neg95.1%
associate-+l+95.1%
+-commutative95.1%
--rgt-identity95.1%
associate--r-95.1%
associate-+r-95.1%
+-commutative95.1%
*-commutative95.1%
sub-neg95.1%
distribute-lft-out--95.2%
distribute-lft-out--98.8%
neg-sub098.8%
distribute-rgt-neg-out98.8%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 78.1%
Taylor expanded in d2 around 0 70.1%
mul-1-neg70.1%
distribute-rgt-neg-out70.1%
+-commutative70.1%
distribute-neg-in70.1%
sub-neg70.1%
Simplified70.1%
if -1.04999999999999997e-274 < d2 Initial program 89.7%
associate--l+89.7%
sub-neg89.7%
associate-+l+89.7%
+-commutative89.7%
--rgt-identity89.7%
associate--r-89.7%
associate-+r-89.7%
+-commutative89.7%
*-commutative89.7%
sub-neg89.7%
distribute-lft-out--90.5%
distribute-lft-out--97.6%
neg-sub097.6%
distribute-rgt-neg-out97.6%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 78.8%
Taylor expanded in d2 around 0 58.4%
Final simplification66.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -4.45e+74) (not (<= d3 1.5e+98))) (* d1 (- d3)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -4.45e+74) || !(d3 <= 1.5e+98)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-4.45d+74)) .or. (.not. (d3 <= 1.5d+98))) then
tmp = d1 * -d3
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -4.45e+74) || !(d3 <= 1.5e+98)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -4.45e+74) or not (d3 <= 1.5e+98): tmp = d1 * -d3 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -4.45e+74) || !(d3 <= 1.5e+98)) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -4.45e+74) || ~((d3 <= 1.5e+98))) tmp = d1 * -d3; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -4.45e+74], N[Not[LessEqual[d3, 1.5e+98]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -4.45 \cdot 10^{+74} \lor \neg \left(d3 \leq 1.5 \cdot 10^{+98}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d3 < -4.4500000000000001e74 or 1.5000000000000001e98 < d3 Initial program 83.1%
associate--l+83.1%
sub-neg83.1%
associate-+l+83.1%
+-commutative83.1%
--rgt-identity83.1%
associate--r-83.1%
associate-+r-83.1%
+-commutative83.1%
*-commutative83.1%
sub-neg83.1%
distribute-lft-out--84.2%
distribute-lft-out--94.7%
neg-sub094.7%
distribute-rgt-neg-out94.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 71.9%
mul-1-neg71.9%
distribute-lft-neg-in71.9%
*-commutative71.9%
Simplified71.9%
if -4.4500000000000001e74 < d3 < 1.5000000000000001e98Initial program 94.4%
associate--l+94.4%
sub-neg94.4%
associate-+l+94.4%
+-commutative94.4%
--rgt-identity94.4%
associate--r-94.4%
associate-+r-94.4%
+-commutative94.4%
*-commutative94.4%
sub-neg94.4%
distribute-lft-out--94.4%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 77.2%
Taylor expanded in d3 around 0 70.5%
Final simplification71.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.1e+156) (* d1 (- d2 (+ d1 d3))) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.1e+156) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * (d4 + d2);
}
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.1d+156) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.1e+156) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.1e+156: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.1e+156) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.1e+156) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.1e+156], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.1 \cdot 10^{+156}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 1.10000000000000002e156Initial program 91.2%
associate--l+91.2%
sub-neg91.2%
associate-+l+91.2%
+-commutative91.2%
--rgt-identity91.2%
associate--r-91.2%
associate-+r-91.2%
+-commutative91.2%
*-commutative91.2%
sub-neg91.2%
distribute-lft-out--91.6%
distribute-lft-out--96.9%
neg-sub096.9%
distribute-rgt-neg-out96.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.7%
if 1.10000000000000002e156 < d4 Initial program 82.1%
associate--l+82.1%
sub-neg82.1%
associate-+l+82.1%
+-commutative82.1%
--rgt-identity82.1%
associate--r-82.1%
associate-+r-82.1%
+-commutative82.1%
*-commutative82.1%
sub-neg82.1%
distribute-lft-out--82.1%
distribute-lft-out--89.2%
neg-sub089.2%
distribute-rgt-neg-out89.2%
distribute-lft-out--99.9%
sub-neg99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in d1 around 0 89.2%
Taylor expanded in d3 around 0 82.1%
Final simplification82.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.4e+95) (* d1 d2) (if (<= d2 1.25e-157) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.4e+95) {
tmp = d1 * d2;
} else if (d2 <= 1.25e-157) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.4d+95)) then
tmp = d1 * d2
else if (d2 <= 1.25d-157) then
tmp = d1 * -d1
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.4e+95) {
tmp = d1 * d2;
} else if (d2 <= 1.25e-157) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.4e+95: tmp = d1 * d2 elif d2 <= 1.25e-157: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.4e+95) tmp = Float64(d1 * d2); elseif (d2 <= 1.25e-157) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.4e+95) tmp = d1 * d2; elseif (d2 <= 1.25e-157) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.4e+95], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, 1.25e-157], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.4 \cdot 10^{+95}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq 1.25 \cdot 10^{-157}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.3999999999999999e95Initial program 82.9%
associate--l+82.9%
sub-neg82.9%
associate-+l+82.9%
+-commutative82.9%
--rgt-identity82.9%
associate--r-82.9%
associate-+r-82.9%
+-commutative82.9%
*-commutative82.9%
sub-neg82.9%
distribute-lft-out--82.9%
distribute-lft-out--87.2%
neg-sub087.2%
distribute-rgt-neg-out87.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 61.6%
if -1.3999999999999999e95 < d2 < 1.25000000000000005e-157Initial program 93.9%
associate--l+93.9%
sub-neg93.9%
associate-+l+93.9%
+-commutative93.9%
--rgt-identity93.9%
associate--r-93.9%
associate-+r-93.9%
+-commutative93.9%
*-commutative93.9%
sub-neg93.9%
distribute-lft-out--94.0%
distribute-lft-out--99.1%
neg-sub099.1%
distribute-rgt-neg-out99.1%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around inf 36.9%
unpow236.9%
mul-1-neg36.9%
distribute-rgt-neg-out36.9%
Simplified36.9%
if 1.25000000000000005e-157 < d2 Initial program 89.2%
associate--l+89.2%
sub-neg89.2%
associate-+l+89.2%
+-commutative89.2%
--rgt-identity89.2%
associate--r-89.2%
associate-+r-89.2%
+-commutative89.2%
*-commutative89.2%
sub-neg89.2%
distribute-lft-out--90.3%
distribute-lft-out--96.7%
neg-sub096.7%
distribute-rgt-neg-out96.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 31.1%
Final simplification39.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.35e+75) (* d1 d2) (if (<= d2 -1.06e-272) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.35e+75) {
tmp = d1 * d2;
} else if (d2 <= -1.06e-272) {
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 <= (-1.35d+75)) then
tmp = d1 * d2
else if (d2 <= (-1.06d-272)) 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 <= -1.35e+75) {
tmp = d1 * d2;
} else if (d2 <= -1.06e-272) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.35e+75: tmp = d1 * d2 elif d2 <= -1.06e-272: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.35e+75) tmp = Float64(d1 * d2); elseif (d2 <= -1.06e-272) 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 <= -1.35e+75) tmp = d1 * d2; elseif (d2 <= -1.06e-272) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.35e+75], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -1.06e-272], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.35 \cdot 10^{+75}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -1.06 \cdot 10^{-272}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.34999999999999999e75Initial program 81.9%
associate--l+81.9%
sub-neg81.9%
associate-+l+81.9%
+-commutative81.9%
--rgt-identity81.9%
associate--r-81.9%
associate-+r-81.9%
+-commutative81.9%
*-commutative81.9%
sub-neg81.9%
distribute-lft-out--81.9%
distribute-lft-out--87.9%
neg-sub087.9%
distribute-rgt-neg-out87.9%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 60.0%
if -1.34999999999999999e75 < d2 < -1.05999999999999994e-272Initial program 97.4%
associate--l+97.4%
sub-neg97.4%
associate-+l+97.4%
+-commutative97.4%
--rgt-identity97.4%
associate--r-97.4%
associate-+r-97.4%
+-commutative97.4%
*-commutative97.4%
sub-neg97.4%
distribute-lft-out--97.4%
distribute-lft-out--98.7%
neg-sub098.7%
distribute-rgt-neg-out98.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 48.5%
mul-1-neg48.5%
distribute-lft-neg-in48.5%
*-commutative48.5%
Simplified48.5%
if -1.05999999999999994e-272 < d2 Initial program 89.0%
associate--l+89.0%
sub-neg89.0%
associate-+l+89.0%
+-commutative89.0%
--rgt-identity89.0%
associate--r-89.0%
associate-+r-89.0%
+-commutative89.0%
*-commutative89.0%
sub-neg89.0%
distribute-lft-out--89.7%
distribute-lft-out--97.6%
neg-sub097.6%
distribute-rgt-neg-out97.6%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 32.0%
Final simplification42.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.9e-96) (* d1 (- d2 d3)) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.9e-96) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-4.9d-96)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.9e-96) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.9e-96: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.9e-96) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -4.9e-96) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.9e-96], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.9 \cdot 10^{-96}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -4.90000000000000016e-96Initial program 88.2%
associate--l+88.2%
sub-neg88.2%
associate-+l+88.2%
+-commutative88.2%
--rgt-identity88.2%
associate--r-88.2%
associate-+r-88.2%
+-commutative88.2%
*-commutative88.2%
sub-neg88.2%
distribute-lft-out--88.2%
distribute-lft-out--91.7%
neg-sub091.7%
distribute-rgt-neg-out91.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.5%
Taylor expanded in d1 around 0 69.5%
if -4.90000000000000016e-96 < d2 Initial program 91.2%
associate--l+91.2%
sub-neg91.2%
associate-+l+91.2%
+-commutative91.2%
--rgt-identity91.2%
associate--r-91.2%
associate-+r-91.2%
+-commutative91.2%
*-commutative91.2%
sub-neg91.2%
distribute-lft-out--91.8%
distribute-lft-out--98.2%
neg-sub098.2%
distribute-rgt-neg-out98.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d1 around 0 79.7%
Taylor expanded in d2 around 0 62.1%
Final simplification64.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.9e-96) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.9e-96) {
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 <= (-4.9d-96)) 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 <= -4.9e-96) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.9e-96: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.9e-96) 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 <= -4.9e-96) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.9e-96], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.9 \cdot 10^{-96}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -4.90000000000000016e-96Initial program 88.2%
associate--l+88.2%
sub-neg88.2%
associate-+l+88.2%
+-commutative88.2%
--rgt-identity88.2%
associate--r-88.2%
associate-+r-88.2%
+-commutative88.2%
*-commutative88.2%
sub-neg88.2%
distribute-lft-out--88.2%
distribute-lft-out--91.7%
neg-sub091.7%
distribute-rgt-neg-out91.7%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 44.4%
if -4.90000000000000016e-96 < d2 Initial program 91.2%
associate--l+91.2%
sub-neg91.2%
associate-+l+91.2%
+-commutative91.2%
--rgt-identity91.2%
associate--r-91.2%
associate-+r-91.2%
+-commutative91.2%
*-commutative91.2%
sub-neg91.2%
distribute-lft-out--91.8%
distribute-lft-out--98.2%
neg-sub098.2%
distribute-rgt-neg-out98.2%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 32.1%
Final simplification36.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 90.2%
associate--l+90.2%
sub-neg90.2%
associate-+l+90.2%
+-commutative90.2%
--rgt-identity90.2%
associate--r-90.2%
associate-+r-90.2%
+-commutative90.2%
*-commutative90.2%
sub-neg90.2%
distribute-lft-out--90.6%
distribute-lft-out--96.1%
neg-sub096.1%
distribute-rgt-neg-out96.1%
distribute-lft-out--100.0%
sub-neg100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 29.9%
Final simplification29.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ (- d2 d3) d4) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (((d2 - d3) + d4) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
def code(d1, d2, d3, d4): return d1 * (((d2 - d3) + d4) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(Float64(d2 - d3) + d4) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (((d2 - d3) + d4) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(N[(d2 - d3), $MachinePrecision] + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)
\end{array}
herbie shell --seed 2023279
(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)))