
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- d2 d1) (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
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) + (d4 - d3))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d1) + (d4 - d3))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d1) + Float64(d4 - d3))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d1) + (d4 - d3)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d1), $MachinePrecision] + N[(d4 - d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d1\right) + \left(d4 - d3\right)\right)
\end{array}
Initial program 89.0%
sub-neg89.0%
associate-+l+89.0%
*-commutative89.0%
+-commutative89.0%
*-commutative89.0%
sub-neg89.0%
+-commutative89.0%
associate--l+89.0%
distribute-lft-out--89.8%
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%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d3))))
(if (<= d4 -1.8e-124)
t_0
(if (<= d4 8e-267)
t_1
(if (<= d4 1.92e-146)
t_0
(if (<= d4 1.6e-73)
t_1
(if (<= d4 5.5e+20) t_0 (* d1 (+ d2 d4)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * -d3;
double tmp;
if (d4 <= -1.8e-124) {
tmp = t_0;
} else if (d4 <= 8e-267) {
tmp = t_1;
} else if (d4 <= 1.92e-146) {
tmp = t_0;
} else if (d4 <= 1.6e-73) {
tmp = t_1;
} else if (d4 <= 5.5e+20) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * -d3
if (d4 <= (-1.8d-124)) then
tmp = t_0
else if (d4 <= 8d-267) then
tmp = t_1
else if (d4 <= 1.92d-146) then
tmp = t_0
else if (d4 <= 1.6d-73) then
tmp = t_1
else if (d4 <= 5.5d+20) then
tmp = t_0
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * -d3;
double tmp;
if (d4 <= -1.8e-124) {
tmp = t_0;
} else if (d4 <= 8e-267) {
tmp = t_1;
} else if (d4 <= 1.92e-146) {
tmp = t_0;
} else if (d4 <= 1.6e-73) {
tmp = t_1;
} else if (d4 <= 5.5e+20) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * -d3 tmp = 0 if d4 <= -1.8e-124: tmp = t_0 elif d4 <= 8e-267: tmp = t_1 elif d4 <= 1.92e-146: tmp = t_0 elif d4 <= 1.6e-73: tmp = t_1 elif d4 <= 5.5e+20: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d4 <= -1.8e-124) tmp = t_0; elseif (d4 <= 8e-267) tmp = t_1; elseif (d4 <= 1.92e-146) tmp = t_0; elseif (d4 <= 1.6e-73) tmp = t_1; elseif (d4 <= 5.5e+20) tmp = t_0; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * -d3; tmp = 0.0; if (d4 <= -1.8e-124) tmp = t_0; elseif (d4 <= 8e-267) tmp = t_1; elseif (d4 <= 1.92e-146) tmp = t_0; elseif (d4 <= 1.6e-73) tmp = t_1; elseif (d4 <= 5.5e+20) tmp = t_0; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d4, -1.8e-124], t$95$0, If[LessEqual[d4, 8e-267], t$95$1, If[LessEqual[d4, 1.92e-146], t$95$0, If[LessEqual[d4, 1.6e-73], t$95$1, If[LessEqual[d4, 5.5e+20], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq -1.8 \cdot 10^{-124}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 8 \cdot 10^{-267}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 1.92 \cdot 10^{-146}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.6 \cdot 10^{-73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 5.5 \cdot 10^{+20}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -1.80000000000000005e-124 or 7.9999999999999999e-267 < d4 < 1.91999999999999999e-146 or 1.59999999999999993e-73 < d4 < 5.5e20Initial program 87.5%
sub-neg87.5%
associate-+l+87.5%
*-commutative87.5%
+-commutative87.5%
*-commutative87.5%
sub-neg87.5%
+-commutative87.5%
associate--l+87.5%
distribute-lft-out--89.0%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 83.4%
+-commutative83.4%
associate--r+83.4%
Simplified83.4%
Taylor expanded in d3 around 0 59.2%
if -1.80000000000000005e-124 < d4 < 7.9999999999999999e-267 or 1.91999999999999999e-146 < d4 < 1.59999999999999993e-73Initial program 94.4%
sub-neg94.4%
associate-+l+94.4%
*-commutative94.4%
+-commutative94.4%
*-commutative94.4%
sub-neg94.4%
+-commutative94.4%
associate--l+94.4%
distribute-lft-out--94.4%
distribute-rgt-out--96.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 60.6%
mul-1-neg60.6%
distribute-rgt-neg-in60.6%
Simplified60.6%
if 5.5e20 < d4 Initial program 87.7%
sub-neg87.7%
associate-+l+87.7%
*-commutative87.7%
+-commutative87.7%
*-commutative87.7%
sub-neg87.7%
+-commutative87.7%
associate--l+87.7%
distribute-lft-out--87.7%
fma-def89.2%
distribute-rgt-out--93.8%
Simplified93.8%
add-cbrt-cube81.9%
pow381.9%
Applied egg-rr81.9%
Taylor expanded in d1 around 0 89.6%
Taylor expanded in d3 around 0 70.4%
+-commutative70.4%
Simplified70.4%
Final simplification62.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 3.15e-261)
t_0
(if (<= d4 8.5e-163)
(* d1 (- d2 d1))
(if (<= d4 2.7e+24) t_0 (* d1 (+ d2 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 3.15e-261) {
tmp = t_0;
} else if (d4 <= 8.5e-163) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2.7e+24) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 3.15d-261) then
tmp = t_0
else if (d4 <= 8.5d-163) then
tmp = d1 * (d2 - d1)
else if (d4 <= 2.7d+24) then
tmp = t_0
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 3.15e-261) {
tmp = t_0;
} else if (d4 <= 8.5e-163) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 2.7e+24) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 3.15e-261: tmp = t_0 elif d4 <= 8.5e-163: tmp = d1 * (d2 - d1) elif d4 <= 2.7e+24: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 3.15e-261) tmp = t_0; elseif (d4 <= 8.5e-163) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 2.7e+24) tmp = t_0; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 3.15e-261) tmp = t_0; elseif (d4 <= 8.5e-163) tmp = d1 * (d2 - d1); elseif (d4 <= 2.7e+24) tmp = t_0; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 3.15e-261], t$95$0, If[LessEqual[d4, 8.5e-163], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 2.7e+24], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 3.15 \cdot 10^{-261}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 8.5 \cdot 10^{-163}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 2.7 \cdot 10^{+24}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 3.15000000000000016e-261 or 8.5e-163 < d4 < 2.7e24Initial program 90.0%
sub-neg90.0%
associate-+l+90.0%
*-commutative90.0%
+-commutative90.0%
*-commutative90.0%
sub-neg90.0%
+-commutative90.0%
associate--l+90.0%
distribute-lft-out--91.1%
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 d4 around 0 86.1%
+-commutative86.1%
associate--r+86.1%
Simplified86.1%
Taylor expanded in d1 around 0 66.7%
if 3.15000000000000016e-261 < d4 < 8.5e-163Initial program 81.8%
sub-neg81.8%
associate-+l+81.8%
*-commutative81.8%
+-commutative81.8%
*-commutative81.8%
sub-neg81.8%
+-commutative81.8%
associate--l+81.8%
distribute-lft-out--81.8%
distribute-rgt-out--95.5%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d3 around 0 87.2%
if 2.7e24 < d4 Initial program 89.0%
sub-neg89.0%
associate-+l+89.0%
*-commutative89.0%
+-commutative89.0%
*-commutative89.0%
sub-neg89.0%
+-commutative89.0%
associate--l+89.0%
distribute-lft-out--89.0%
fma-def90.6%
distribute-rgt-out--95.3%
Simplified95.3%
add-cbrt-cube83.2%
pow383.2%
Applied egg-rr83.2%
Taylor expanded in d1 around 0 89.4%
Taylor expanded in d3 around 0 71.5%
+-commutative71.5%
Simplified71.5%
Final simplification69.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 7e-262)
t_0
(if (<= d4 1e-160)
(* d1 (- d2 d1))
(if (<= d4 6.5e+16) t_0 (* d1 (- d4 d3)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 7e-262) {
tmp = t_0;
} else if (d4 <= 1e-160) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 6.5e+16) {
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 - d3)
if (d4 <= 7d-262) then
tmp = t_0
else if (d4 <= 1d-160) then
tmp = d1 * (d2 - d1)
else if (d4 <= 6.5d+16) 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 - d3);
double tmp;
if (d4 <= 7e-262) {
tmp = t_0;
} else if (d4 <= 1e-160) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 6.5e+16) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 7e-262: tmp = t_0 elif d4 <= 1e-160: tmp = d1 * (d2 - d1) elif d4 <= 6.5e+16: tmp = t_0 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 7e-262) tmp = t_0; elseif (d4 <= 1e-160) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 6.5e+16) 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 - d3); tmp = 0.0; if (d4 <= 7e-262) tmp = t_0; elseif (d4 <= 1e-160) tmp = d1 * (d2 - d1); elseif (d4 <= 6.5e+16) 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 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 7e-262], t$95$0, If[LessEqual[d4, 1e-160], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 6.5e+16], t$95$0, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 7 \cdot 10^{-262}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 10^{-160}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 6.5 \cdot 10^{+16}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 7.00000000000000023e-262 or 9.9999999999999999e-161 < d4 < 6.5e16Initial program 90.4%
sub-neg90.4%
associate-+l+90.4%
*-commutative90.4%
+-commutative90.4%
*-commutative90.4%
sub-neg90.4%
+-commutative90.4%
associate--l+90.4%
distribute-lft-out--91.6%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.9%
+-commutative85.9%
associate--r+85.9%
Simplified85.9%
Taylor expanded in d1 around 0 66.3%
if 7.00000000000000023e-262 < d4 < 9.9999999999999999e-161Initial program 81.8%
sub-neg81.8%
associate-+l+81.8%
*-commutative81.8%
+-commutative81.8%
*-commutative81.8%
sub-neg81.8%
+-commutative81.8%
associate--l+81.8%
distribute-lft-out--81.8%
distribute-rgt-out--95.5%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d3 around 0 87.2%
if 6.5e16 < d4 Initial program 87.9%
sub-neg87.9%
associate-+l+87.9%
*-commutative87.9%
+-commutative87.9%
*-commutative87.9%
sub-neg87.9%
+-commutative87.9%
associate--l+87.9%
distribute-lft-out--87.9%
fma-def89.4%
distribute-rgt-out--93.9%
Simplified93.9%
add-cbrt-cube80.8%
pow380.8%
Applied egg-rr80.8%
Taylor expanded in d1 around 0 89.8%
Taylor expanded in d2 around 0 79.4%
Final simplification71.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -6.2e+96) (not (<= d1 8e+110))) (* d1 (- (+ d2 d4) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -6.2e+96) || !(d1 <= 8e+110)) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d1 <= (-6.2d+96)) .or. (.not. (d1 <= 8d+110))) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -6.2e+96) || !(d1 <= 8e+110)) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -6.2e+96) or not (d1 <= 8e+110): tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -6.2e+96) || !(d1 <= 8e+110)) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -6.2e+96) || ~((d1 <= 8e+110))) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -6.2e+96], N[Not[LessEqual[d1, 8e+110]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -6.2 \cdot 10^{+96} \lor \neg \left(d1 \leq 8 \cdot 10^{+110}\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -6.1999999999999996e96 or 8.0000000000000002e110 < d1 Initial program 65.8%
sub-neg65.8%
associate-+l+65.8%
*-commutative65.8%
+-commutative65.8%
*-commutative65.8%
sub-neg65.8%
+-commutative65.8%
associate--l+65.8%
distribute-lft-out--68.3%
distribute-rgt-out--74.7%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.5%
if -6.1999999999999996e96 < d1 < 8.0000000000000002e110Initial program 99.4%
sub-neg99.4%
associate-+l+99.4%
*-commutative99.4%
+-commutative99.4%
*-commutative99.4%
sub-neg99.4%
+-commutative99.4%
associate--l+99.4%
distribute-lft-out--99.4%
fma-def99.4%
distribute-rgt-out--99.4%
Simplified99.4%
add-cbrt-cube83.3%
pow383.3%
Applied egg-rr83.3%
Taylor expanded in d1 around 0 95.8%
Final simplification96.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -1.65e+153) (* d1 (- d2 d3)) (if (<= d3 8.2e+113) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1.65e+153) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 8.2e+113) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d3 <= (-1.65d+153)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 8.2d+113) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -1.65e+153) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 8.2e+113) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -1.65e+153: tmp = d1 * (d2 - d3) elif d3 <= 8.2e+113: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -1.65e+153) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 8.2e+113) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -1.65e+153) tmp = d1 * (d2 - d3); elseif (d3 <= 8.2e+113) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -1.65e+153], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 8.2e+113], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.65 \cdot 10^{+153}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 8.2 \cdot 10^{+113}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -1.64999999999999997e153Initial program 81.0%
sub-neg81.0%
associate-+l+81.0%
*-commutative81.0%
+-commutative81.0%
*-commutative81.0%
sub-neg81.0%
+-commutative81.0%
associate--l+81.0%
distribute-lft-out--85.7%
distribute-rgt-out--85.7%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 90.9%
+-commutative90.9%
associate--r+90.9%
Simplified90.9%
Taylor expanded in d1 around 0 83.8%
if -1.64999999999999997e153 < d3 < 8.19999999999999985e113Initial 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--94.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 d3 around 0 90.4%
if 8.19999999999999985e113 < d3 Initial 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--88.3%
fma-def95.3%
distribute-rgt-out--97.6%
Simplified97.6%
add-cbrt-cube89.1%
pow389.1%
Applied egg-rr89.1%
Taylor expanded in d1 around 0 97.6%
Taylor expanded in d2 around 0 87.3%
Final simplification88.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -6.2e+175) (not (<= d3 1.55e+114))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -6.2e+175) || !(d3 <= 1.55e+114)) {
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 <= (-6.2d+175)) .or. (.not. (d3 <= 1.55d+114))) 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 <= -6.2e+175) || !(d3 <= 1.55e+114)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -6.2e+175) or not (d3 <= 1.55e+114): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -6.2e+175) || !(d3 <= 1.55e+114)) 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 <= -6.2e+175) || ~((d3 <= 1.55e+114))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -6.2e+175], N[Not[LessEqual[d3, 1.55e+114]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -6.2 \cdot 10^{+175} \lor \neg \left(d3 \leq 1.55 \cdot 10^{+114}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -6.19999999999999968e175 or 1.55e114 < d3 Initial program 84.1%
sub-neg84.1%
associate-+l+84.1%
*-commutative84.1%
+-commutative84.1%
*-commutative84.1%
sub-neg84.1%
+-commutative84.1%
associate--l+84.1%
distribute-lft-out--86.6%
distribute-rgt-out--86.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 inf 78.4%
mul-1-neg78.4%
distribute-rgt-neg-in78.4%
Simplified78.4%
if -6.19999999999999968e175 < d3 < 1.55e114Initial program 91.3%
sub-neg91.3%
associate-+l+91.3%
*-commutative91.3%
+-commutative91.3%
*-commutative91.3%
sub-neg91.3%
+-commutative91.3%
associate--l+91.3%
distribute-lft-out--91.3%
fma-def93.7%
distribute-rgt-out--98.8%
Simplified98.8%
add-cbrt-cube78.8%
pow378.8%
Applied egg-rr78.8%
Taylor expanded in d1 around 0 76.6%
Taylor expanded in d3 around 0 66.6%
+-commutative66.6%
Simplified66.6%
Final simplification70.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 -2.6e-124) (* d1 d2) (if (<= d4 2.7e+24) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -2.6e-124) {
tmp = d1 * d2;
} else if (d4 <= 2.7e+24) {
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 <= (-2.6d-124)) then
tmp = d1 * d2
else if (d4 <= 2.7d+24) 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 <= -2.6e-124) {
tmp = d1 * d2;
} else if (d4 <= 2.7e+24) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -2.6e-124: tmp = d1 * d2 elif d4 <= 2.7e+24: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -2.6e-124) tmp = Float64(d1 * d2); elseif (d4 <= 2.7e+24) 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 <= -2.6e-124) tmp = d1 * d2; elseif (d4 <= 2.7e+24) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -2.6e-124], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 2.7e+24], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -2.6 \cdot 10^{-124}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 2.7 \cdot 10^{+24}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -2.6e-124Initial 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.3%
distribute-rgt-out--91.3%
distribute-lft-out99.9%
+-commutative99.9%
sub-neg99.9%
+-commutative99.9%
remove-double-neg99.9%
sub-neg99.9%
sub-neg99.9%
distribute-neg-in99.9%
sub-neg99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in d2 around inf 29.4%
if -2.6e-124 < d4 < 2.7e24Initial program 89.9%
sub-neg89.9%
associate-+l+89.9%
*-commutative89.9%
+-commutative89.9%
*-commutative89.9%
sub-neg89.9%
+-commutative89.9%
associate--l+89.9%
distribute-lft-out--89.9%
distribute-rgt-out--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 d3 around inf 48.8%
mul-1-neg48.8%
distribute-rgt-neg-in48.8%
Simplified48.8%
if 2.7e24 < d4 Initial program 89.0%
sub-neg89.0%
associate-+l+89.0%
*-commutative89.0%
+-commutative89.0%
*-commutative89.0%
sub-neg89.0%
+-commutative89.0%
associate--l+89.0%
distribute-lft-out--89.0%
distribute-rgt-out--89.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 60.9%
Final simplification44.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.25e+17) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.25e+17) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2.25d+17) then
tmp = d1 * ((d2 - d3) - d1)
else
tmp = d1 * ((d4 - d3) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.25e+17) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.25e+17: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.25e+17) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(d4 - d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.25e+17) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.25e+17], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.25 \cdot 10^{+17}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d4 < 2.25e17Initial program 89.4%
sub-neg89.4%
associate-+l+89.4%
*-commutative89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
distribute-lft-out--90.5%
distribute-rgt-out--93.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 d4 around 0 87.5%
+-commutative87.5%
associate--r+87.5%
Simplified87.5%
if 2.25e17 < d4 Initial program 87.9%
sub-neg87.9%
associate-+l+87.9%
*-commutative87.9%
+-commutative87.9%
*-commutative87.9%
sub-neg87.9%
+-commutative87.9%
associate--l+87.9%
distribute-lft-out--87.9%
distribute-rgt-out--87.9%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 89.7%
+-commutative89.7%
associate--r+89.7%
Simplified89.7%
Final simplification88.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.15e+17) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.15e+17) {
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 <= 2.15d+17) 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 <= 2.15e+17) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.15e+17: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.15e+17) 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 <= 2.15e+17) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.15e+17], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.15 \cdot 10^{+17}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.15e17Initial program 89.4%
sub-neg89.4%
associate-+l+89.4%
*-commutative89.4%
+-commutative89.4%
*-commutative89.4%
sub-neg89.4%
+-commutative89.4%
associate--l+89.4%
distribute-lft-out--90.5%
distribute-rgt-out--93.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 33.0%
if 2.15e17 < d4 Initial program 87.9%
sub-neg87.9%
associate-+l+87.9%
*-commutative87.9%
+-commutative87.9%
*-commutative87.9%
sub-neg87.9%
+-commutative87.9%
associate--l+87.9%
distribute-lft-out--87.9%
distribute-rgt-out--87.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 d4 around inf 59.2%
Final simplification39.8%
(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 89.0%
sub-neg89.0%
associate-+l+89.0%
*-commutative89.0%
+-commutative89.0%
*-commutative89.0%
sub-neg89.0%
+-commutative89.0%
associate--l+89.0%
distribute-lft-out--89.8%
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 d2 around inf 28.6%
Final simplification28.6%
(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 2024020
(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)))