
(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 12 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--92.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%
Final simplification100.0%
(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.62e+69)
t_1
(if (<= d3 -800000000000.0)
t_2
(if (<= d3 -1.4e-128)
t_0
(if (<= d3 2.6e-291)
t_2
(if (<= d3 1.85e-207) t_0 (if (<= d3 2.5e+102) t_2 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.62e+69) {
tmp = t_1;
} else if (d3 <= -800000000000.0) {
tmp = t_2;
} else if (d3 <= -1.4e-128) {
tmp = t_0;
} else if (d3 <= 2.6e-291) {
tmp = t_2;
} else if (d3 <= 1.85e-207) {
tmp = t_0;
} else if (d3 <= 2.5e+102) {
tmp = t_2;
} 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.62d+69)) then
tmp = t_1
else if (d3 <= (-800000000000.0d0)) then
tmp = t_2
else if (d3 <= (-1.4d-128)) then
tmp = t_0
else if (d3 <= 2.6d-291) then
tmp = t_2
else if (d3 <= 1.85d-207) then
tmp = t_0
else if (d3 <= 2.5d+102) then
tmp = t_2
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.62e+69) {
tmp = t_1;
} else if (d3 <= -800000000000.0) {
tmp = t_2;
} else if (d3 <= -1.4e-128) {
tmp = t_0;
} else if (d3 <= 2.6e-291) {
tmp = t_2;
} else if (d3 <= 1.85e-207) {
tmp = t_0;
} else if (d3 <= 2.5e+102) {
tmp = t_2;
} 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.62e+69: tmp = t_1 elif d3 <= -800000000000.0: tmp = t_2 elif d3 <= -1.4e-128: tmp = t_0 elif d3 <= 2.6e-291: tmp = t_2 elif d3 <= 1.85e-207: tmp = t_0 elif d3 <= 2.5e+102: tmp = t_2 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.62e+69) tmp = t_1; elseif (d3 <= -800000000000.0) tmp = t_2; elseif (d3 <= -1.4e-128) tmp = t_0; elseif (d3 <= 2.6e-291) tmp = t_2; elseif (d3 <= 1.85e-207) tmp = t_0; elseif (d3 <= 2.5e+102) tmp = t_2; 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.62e+69) tmp = t_1; elseif (d3 <= -800000000000.0) tmp = t_2; elseif (d3 <= -1.4e-128) tmp = t_0; elseif (d3 <= 2.6e-291) tmp = t_2; elseif (d3 <= 1.85e-207) tmp = t_0; elseif (d3 <= 2.5e+102) tmp = t_2; 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.62e+69], t$95$1, If[LessEqual[d3, -800000000000.0], t$95$2, If[LessEqual[d3, -1.4e-128], t$95$0, If[LessEqual[d3, 2.6e-291], t$95$2, If[LessEqual[d3, 1.85e-207], t$95$0, If[LessEqual[d3, 2.5e+102], t$95$2, 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.62 \cdot 10^{+69}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq -800000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq -1.4 \cdot 10^{-128}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 2.6 \cdot 10^{-291}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 1.85 \cdot 10^{-207}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 2.5 \cdot 10^{+102}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d3 < -1.62e69 or 2.5e102 < d3 Initial program 83.8%
sub-neg83.8%
associate-+l+83.8%
*-commutative83.8%
+-commutative83.8%
*-commutative83.8%
sub-neg83.8%
+-commutative83.8%
associate--l+83.8%
distribute-lft-out--86.2%
distribute-rgt-out--88.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 86.4%
+-commutative86.4%
associate--r+86.4%
Simplified86.4%
Taylor expanded in d1 around 0 79.1%
if -1.62e69 < d3 < -8e11 or -1.3999999999999999e-128 < d3 < 2.5999999999999999e-291 or 1.84999999999999992e-207 < d3 < 2.5e102Initial program 92.3%
sub-neg92.3%
associate-+l+92.3%
*-commutative92.3%
+-commutative92.3%
*-commutative92.3%
sub-neg92.3%
+-commutative92.3%
associate--l+92.3%
distribute-lft-out--92.3%
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%
associate--r-100.0%
distribute-rgt-in95.4%
associate--l-95.4%
*-commutative95.4%
Applied egg-rr95.4%
Taylor expanded in d1 around 0 87.8%
Taylor expanded in d3 around 0 81.6%
distribute-lft-out81.7%
Simplified81.7%
if -8e11 < d3 < -1.3999999999999999e-128 or 2.5999999999999999e-291 < d3 < 1.84999999999999992e-207Initial program 88.9%
sub-neg88.9%
associate-+l+88.9%
*-commutative88.9%
+-commutative88.9%
*-commutative88.9%
sub-neg88.9%
+-commutative88.9%
associate--l+88.9%
distribute-lft-out--88.9%
distribute-rgt-out--97.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 81.9%
+-commutative81.9%
associate--r+81.9%
Simplified81.9%
Taylor expanded in d3 around 0 77.7%
Final simplification80.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -2.1e-91)
t_1
(if (<= d4 2.9e-258)
t_0
(if (<= d4 2.8e-198)
t_1
(if (<= d4 1.35e-133)
t_0
(if (<= d4 2.1e+26) t_1 (* d1 (- d4 d1)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -2.1e-91) {
tmp = t_1;
} else if (d4 <= 2.9e-258) {
tmp = t_0;
} else if (d4 <= 2.8e-198) {
tmp = t_1;
} else if (d4 <= 1.35e-133) {
tmp = t_0;
} else if (d4 <= 2.1e+26) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= (-2.1d-91)) then
tmp = t_1
else if (d4 <= 2.9d-258) then
tmp = t_0
else if (d4 <= 2.8d-198) then
tmp = t_1
else if (d4 <= 1.35d-133) then
tmp = t_0
else if (d4 <= 2.1d+26) then
tmp = t_1
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 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -2.1e-91) {
tmp = t_1;
} else if (d4 <= 2.9e-258) {
tmp = t_0;
} else if (d4 <= 2.8e-198) {
tmp = t_1;
} else if (d4 <= 1.35e-133) {
tmp = t_0;
} else if (d4 <= 2.1e+26) {
tmp = t_1;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -2.1e-91: tmp = t_1 elif d4 <= 2.9e-258: tmp = t_0 elif d4 <= 2.8e-198: tmp = t_1 elif d4 <= 1.35e-133: tmp = t_0 elif d4 <= 2.1e+26: tmp = t_1 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= -2.1e-91) tmp = t_1; elseif (d4 <= 2.9e-258) tmp = t_0; elseif (d4 <= 2.8e-198) tmp = t_1; elseif (d4 <= 1.35e-133) tmp = t_0; elseif (d4 <= 2.1e+26) tmp = t_1; else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= -2.1e-91) tmp = t_1; elseif (d4 <= 2.9e-258) tmp = t_0; elseif (d4 <= 2.8e-198) tmp = t_1; elseif (d4 <= 1.35e-133) tmp = t_0; elseif (d4 <= 2.1e+26) tmp = t_1; else tmp = d1 * (d4 - d1); 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]}, If[LessEqual[d4, -2.1e-91], t$95$1, If[LessEqual[d4, 2.9e-258], t$95$0, If[LessEqual[d4, 2.8e-198], t$95$1, If[LessEqual[d4, 1.35e-133], t$95$0, If[LessEqual[d4, 2.1e+26], t$95$1, N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq -2.1 \cdot 10^{-91}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 2.9 \cdot 10^{-258}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.8 \cdot 10^{-198}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.35 \cdot 10^{-133}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.1 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < -2.0999999999999999e-91 or 2.9e-258 < d4 < 2.7999999999999999e-198 or 1.3499999999999999e-133 < d4 < 2.1000000000000001e26Initial program 87.4%
sub-neg87.4%
associate-+l+87.4%
*-commutative87.4%
+-commutative87.4%
*-commutative87.4%
sub-neg87.4%
+-commutative87.4%
associate--l+87.4%
distribute-lft-out--88.9%
distribute-rgt-out--91.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 72.2%
+-commutative72.2%
associate--r+72.2%
Simplified72.2%
Taylor expanded in d1 around 0 58.4%
if -2.0999999999999999e-91 < d4 < 2.9e-258 or 2.7999999999999999e-198 < d4 < 1.3499999999999999e-133Initial 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--97.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 99.4%
+-commutative99.4%
associate--r+99.4%
Simplified99.4%
Taylor expanded in d3 around 0 74.0%
if 2.1000000000000001e26 < d4 Initial program 90.6%
sub-neg90.6%
associate-+l+90.6%
*-commutative90.6%
+-commutative90.6%
*-commutative90.6%
sub-neg90.6%
+-commutative90.6%
associate--l+90.6%
distribute-lft-out--90.5%
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 0 86.8%
associate--r+86.8%
Simplified86.8%
Taylor expanded in d3 around 0 78.3%
Final simplification66.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d3 -4.1e+104)
(* d1 (- d2 d3))
(if (or (<= d3 9.8e+31) (and (not (<= d3 8e+58)) (<= d3 6.5e+141)))
(* d1 (- (+ d2 d4) d1))
(* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -4.1e+104) {
tmp = d1 * (d2 - d3);
} else if ((d3 <= 9.8e+31) || (!(d3 <= 8e+58) && (d3 <= 6.5e+141))) {
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 <= (-4.1d+104)) then
tmp = d1 * (d2 - d3)
else if ((d3 <= 9.8d+31) .or. (.not. (d3 <= 8d+58)) .and. (d3 <= 6.5d+141)) 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 <= -4.1e+104) {
tmp = d1 * (d2 - d3);
} else if ((d3 <= 9.8e+31) || (!(d3 <= 8e+58) && (d3 <= 6.5e+141))) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -4.1e+104: tmp = d1 * (d2 - d3) elif (d3 <= 9.8e+31) or (not (d3 <= 8e+58) and (d3 <= 6.5e+141)): tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -4.1e+104) tmp = Float64(d1 * Float64(d2 - d3)); elseif ((d3 <= 9.8e+31) || (!(d3 <= 8e+58) && (d3 <= 6.5e+141))) 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 <= -4.1e+104) tmp = d1 * (d2 - d3); elseif ((d3 <= 9.8e+31) || (~((d3 <= 8e+58)) && (d3 <= 6.5e+141))) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -4.1e+104], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d3, 9.8e+31], And[N[Not[LessEqual[d3, 8e+58]], $MachinePrecision], LessEqual[d3, 6.5e+141]]], 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 -4.1 \cdot 10^{+104}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 9.8 \cdot 10^{+31} \lor \neg \left(d3 \leq 8 \cdot 10^{+58}\right) \land d3 \leq 6.5 \cdot 10^{+141}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -4.09999999999999985e104Initial program 83.0%
sub-neg83.0%
associate-+l+83.0%
*-commutative83.0%
+-commutative83.0%
*-commutative83.0%
sub-neg83.0%
+-commutative83.0%
associate--l+83.0%
distribute-lft-out--87.2%
distribute-rgt-out--89.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 83.1%
+-commutative83.1%
associate--r+83.1%
Simplified83.1%
Taylor expanded in d1 around 0 76.7%
if -4.09999999999999985e104 < d3 < 9.79999999999999991e31 or 7.99999999999999955e58 < d3 < 6.50000000000000053e141Initial program 90.6%
sub-neg90.6%
associate-+l+90.6%
*-commutative90.6%
+-commutative90.6%
*-commutative90.6%
sub-neg90.6%
+-commutative90.6%
associate--l+90.6%
distribute-lft-out--90.6%
distribute-rgt-out--94.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 d3 around 0 95.4%
if 9.79999999999999991e31 < d3 < 7.99999999999999955e58 or 6.50000000000000053e141 < 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--88.9%
distribute-rgt-out--88.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 96.3%
associate--r+96.3%
Simplified96.3%
Taylor expanded in d1 around 0 92.6%
Final simplification91.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (or (<= d3 -1.66e+162)
(and (not (<= d3 -9.5e+134))
(or (<= d3 -1.9e+102) (not (<= d3 8.5e+141)))))
(* d1 (- d3))
(* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.66e+162) || (!(d3 <= -9.5e+134) && ((d3 <= -1.9e+102) || !(d3 <= 8.5e+141)))) {
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.66d+162)) .or. (.not. (d3 <= (-9.5d+134))) .and. (d3 <= (-1.9d+102)) .or. (.not. (d3 <= 8.5d+141))) 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.66e+162) || (!(d3 <= -9.5e+134) && ((d3 <= -1.9e+102) || !(d3 <= 8.5e+141)))) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.66e+162) or (not (d3 <= -9.5e+134) and ((d3 <= -1.9e+102) or not (d3 <= 8.5e+141))): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.66e+162) || (!(d3 <= -9.5e+134) && ((d3 <= -1.9e+102) || !(d3 <= 8.5e+141)))) 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.66e+162) || (~((d3 <= -9.5e+134)) && ((d3 <= -1.9e+102) || ~((d3 <= 8.5e+141))))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.66e+162], And[N[Not[LessEqual[d3, -9.5e+134]], $MachinePrecision], Or[LessEqual[d3, -1.9e+102], N[Not[LessEqual[d3, 8.5e+141]], $MachinePrecision]]]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.66 \cdot 10^{+162} \lor \neg \left(d3 \leq -9.5 \cdot 10^{+134}\right) \land \left(d3 \leq -1.9 \cdot 10^{+102} \lor \neg \left(d3 \leq 8.5 \cdot 10^{+141}\right)\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.66000000000000003e162 or -9.5000000000000004e134 < d3 < -1.89999999999999989e102 or 8.4999999999999996e141 < d3 Initial program 80.3%
sub-neg80.3%
associate-+l+80.3%
*-commutative80.3%
+-commutative80.3%
*-commutative80.3%
sub-neg80.3%
+-commutative80.3%
associate--l+80.3%
distribute-lft-out--83.6%
distribute-rgt-out--86.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 80.4%
mul-1-neg80.4%
distribute-lft-neg-in80.4%
*-commutative80.4%
Simplified80.4%
if -1.66000000000000003e162 < d3 < -9.5000000000000004e134 or -1.89999999999999989e102 < d3 < 8.4999999999999996e141Initial program 91.8%
sub-neg91.8%
associate-+l+91.8%
*-commutative91.8%
+-commutative91.8%
*-commutative91.8%
sub-neg91.8%
+-commutative91.8%
associate--l+91.8%
distribute-lft-out--91.8%
distribute-rgt-out--94.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in96.4%
associate--l-96.4%
*-commutative96.4%
Applied egg-rr96.4%
Taylor expanded in d1 around 0 80.0%
Taylor expanded in d3 around 0 72.3%
distribute-lft-out72.4%
Simplified72.4%
Final simplification74.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))))
(if (<= d4 2.2e-169)
(* d1 d2)
(if (<= d4 1.4e-79)
t_0
(if (<= d4 3.5e-44) (* d1 d2) (if (<= d4 4.2e+90) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d4 <= 2.2e-169) {
tmp = d1 * d2;
} else if (d4 <= 1.4e-79) {
tmp = t_0;
} else if (d4 <= 3.5e-44) {
tmp = d1 * d2;
} else if (d4 <= 4.2e+90) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = d1 * -d3
if (d4 <= 2.2d-169) then
tmp = d1 * d2
else if (d4 <= 1.4d-79) then
tmp = t_0
else if (d4 <= 3.5d-44) then
tmp = d1 * d2
else if (d4 <= 4.2d+90) then
tmp = t_0
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d4 <= 2.2e-169) {
tmp = d1 * d2;
} else if (d4 <= 1.4e-79) {
tmp = t_0;
} else if (d4 <= 3.5e-44) {
tmp = d1 * d2;
} else if (d4 <= 4.2e+90) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 tmp = 0 if d4 <= 2.2e-169: tmp = d1 * d2 elif d4 <= 1.4e-79: tmp = t_0 elif d4 <= 3.5e-44: tmp = d1 * d2 elif d4 <= 4.2e+90: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d4 <= 2.2e-169) tmp = Float64(d1 * d2); elseif (d4 <= 1.4e-79) tmp = t_0; elseif (d4 <= 3.5e-44) tmp = Float64(d1 * d2); elseif (d4 <= 4.2e+90) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; tmp = 0.0; if (d4 <= 2.2e-169) tmp = d1 * d2; elseif (d4 <= 1.4e-79) tmp = t_0; elseif (d4 <= 3.5e-44) tmp = d1 * d2; elseif (d4 <= 4.2e+90) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d4, 2.2e-169], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.4e-79], t$95$0, If[LessEqual[d4, 3.5e-44], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 4.2e+90], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq 2.2 \cdot 10^{-169}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.4 \cdot 10^{-79}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 3.5 \cdot 10^{-44}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{+90}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.20000000000000007e-169 or 1.40000000000000006e-79 < d4 < 3.4999999999999998e-44Initial program 88.5%
sub-neg88.5%
associate-+l+88.5%
*-commutative88.5%
+-commutative88.5%
*-commutative88.5%
sub-neg88.5%
+-commutative88.5%
associate--l+88.5%
distribute-lft-out--89.6%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 38.7%
if 2.20000000000000007e-169 < d4 < 1.40000000000000006e-79 or 3.4999999999999998e-44 < d4 < 4.19999999999999961e90Initial program 88.9%
sub-neg88.9%
associate-+l+88.9%
*-commutative88.9%
+-commutative88.9%
*-commutative88.9%
sub-neg88.9%
+-commutative88.9%
associate--l+88.9%
distribute-lft-out--88.9%
distribute-rgt-out--94.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 38.0%
mul-1-neg38.0%
distribute-lft-neg-in38.0%
*-commutative38.0%
Simplified38.0%
if 4.19999999999999961e90 < d4 Initial program 91.3%
sub-neg91.3%
associate-+l+91.3%
*-commutative91.3%
+-commutative91.3%
*-commutative91.3%
sub-neg91.3%
+-commutative91.3%
associate--l+91.3%
distribute-lft-out--91.3%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 68.9%
Final simplification44.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -4.6e+27) (* d1 (- d2 d3)) (if (<= d2 -1.55e-189) (* d1 (- d4 d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.6e+27) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.55e-189) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-4.6d+27)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-1.55d-189)) then
tmp = d1 * (d4 - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -4.6e+27) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -1.55e-189) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -4.6e+27: tmp = d1 * (d2 - d3) elif d2 <= -1.55e-189: tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -4.6e+27) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -1.55e-189) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -4.6e+27) tmp = d1 * (d2 - d3); elseif (d2 <= -1.55e-189) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -4.6e+27], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -1.55e-189], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -4.6 \cdot 10^{+27}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -1.55 \cdot 10^{-189}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -4.6000000000000001e27Initial program 84.5%
sub-neg84.5%
associate-+l+84.5%
*-commutative84.5%
+-commutative84.5%
*-commutative84.5%
sub-neg84.5%
+-commutative84.5%
associate--l+84.5%
distribute-lft-out--84.5%
distribute-rgt-out--90.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 78.8%
+-commutative78.8%
associate--r+78.8%
Simplified78.8%
Taylor expanded in d1 around 0 72.6%
if -4.6000000000000001e27 < d2 < -1.55e-189Initial program 93.3%
sub-neg93.3%
associate-+l+93.3%
*-commutative93.3%
+-commutative93.3%
*-commutative93.3%
sub-neg93.3%
+-commutative93.3%
associate--l+93.3%
distribute-lft-out--93.3%
distribute-rgt-out--93.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 d2 around 0 87.6%
associate--r+87.6%
Simplified87.6%
Taylor expanded in d3 around 0 71.9%
if -1.55e-189 < d2 Initial 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.4%
distribute-rgt-out--94.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 d2 around 0 79.2%
associate--r+79.2%
Simplified79.2%
Taylor expanded in d1 around 0 60.8%
Final simplification66.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.86e+33) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.86e+33) {
tmp = d1 * ((d2 - d3) - d1);
} 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 <= 1.86d+33) then
tmp = d1 * ((d2 - d3) - d1)
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 <= 1.86e+33) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.86e+33: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.86e+33) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); 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 <= 1.86e+33) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.86e+33], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.86 \cdot 10^{+33}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d4 < 1.8599999999999999e33Initial program 88.7%
sub-neg88.7%
associate-+l+88.7%
*-commutative88.7%
+-commutative88.7%
*-commutative88.7%
sub-neg88.7%
+-commutative88.7%
associate--l+88.7%
distribute-lft-out--89.7%
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 81.4%
+-commutative81.4%
associate--r+81.4%
Simplified81.4%
if 1.8599999999999999e33 < d4 Initial program 90.4%
sub-neg90.4%
associate-+l+90.4%
*-commutative90.4%
+-commutative90.4%
*-commutative90.4%
sub-neg90.4%
+-commutative90.4%
associate--l+90.4%
distribute-lft-out--90.4%
distribute-rgt-out--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 0 91.3%
Final simplification83.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 8.5e+25) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d1) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.5e+25) {
tmp = d1 * ((d2 - d3) - d1);
} 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 <= 8.5d+25) then
tmp = d1 * ((d2 - d3) - d1)
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 <= 8.5e+25) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 8.5e+25: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 8.5e+25) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); 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 <= 8.5e+25) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 8.5e+25], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 8.5 \cdot 10^{+25}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 8.5000000000000007e25Initial program 88.6%
sub-neg88.6%
associate-+l+88.6%
*-commutative88.6%
+-commutative88.6%
*-commutative88.6%
sub-neg88.6%
+-commutative88.6%
associate--l+88.6%
distribute-lft-out--89.6%
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 81.3%
+-commutative81.3%
associate--r+81.3%
Simplified81.3%
if 8.5000000000000007e25 < d4 Initial program 90.6%
sub-neg90.6%
associate-+l+90.6%
*-commutative90.6%
+-commutative90.6%
*-commutative90.6%
sub-neg90.6%
+-commutative90.6%
associate--l+90.6%
distribute-lft-out--90.5%
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 0 86.8%
associate--r+86.8%
Simplified86.8%
Final simplification82.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.8e+45) (* d1 (- d2 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.8e+45) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2.8d+45) then
tmp = d1 * (d2 - d1)
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.8e+45) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.8e+45: tmp = d1 * (d2 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.8e+45) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.8e+45) tmp = d1 * (d2 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.8e+45], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.8 \cdot 10^{+45}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 2.7999999999999999e45Initial 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--89.3%
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 d4 around 0 81.1%
+-commutative81.1%
associate--r+81.1%
Simplified81.1%
Taylor expanded in d3 around 0 60.0%
if 2.7999999999999999e45 < d4 Initial program 92.0%
sub-neg92.0%
associate-+l+92.0%
*-commutative92.0%
+-commutative92.0%
*-commutative92.0%
sub-neg92.0%
+-commutative92.0%
associate--l+92.0%
distribute-lft-out--92.0%
distribute-rgt-out--94.0%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
associate--r-100.0%
distribute-rgt-in94.0%
associate--l-94.0%
*-commutative94.0%
Applied egg-rr94.0%
Taylor expanded in d1 around 0 92.0%
Taylor expanded in d3 around 0 83.0%
distribute-lft-out83.0%
Simplified83.0%
Final simplification64.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 4.9e+25) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.9e+25) {
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 <= 4.9d+25) 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 <= 4.9e+25) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 4.9e+25: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 4.9e+25) 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 <= 4.9e+25) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 4.9e+25], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 4.9 \cdot 10^{+25}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 4.9000000000000001e25Initial program 88.6%
sub-neg88.6%
associate-+l+88.6%
*-commutative88.6%
+-commutative88.6%
*-commutative88.6%
sub-neg88.6%
+-commutative88.6%
associate--l+88.6%
distribute-lft-out--89.6%
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 38.9%
if 4.9000000000000001e25 < d4 Initial program 90.6%
sub-neg90.6%
associate-+l+90.6%
*-commutative90.6%
+-commutative90.6%
*-commutative90.6%
sub-neg90.6%
+-commutative90.6%
associate--l+90.6%
distribute-lft-out--90.5%
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 d4 around inf 65.2%
Final simplification44.3%
(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--92.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 inf 36.9%
Final simplification36.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 2024027
(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)))