
(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 (- (+ d4 (- d2 d3)) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 + (d2 - d3)) - 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 * ((d4 + (d2 - d3)) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 + (d2 - d3)) - d1);
}
def code(d1, d2, d3, d4): return d1 * ((d4 + (d2 - d3)) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d4 + Float64(d2 - d3)) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d4 + (d2 - d3)) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d4 + N[(d2 - d3), $MachinePrecision]), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d4 + \left(d2 - d3\right)\right) - d1\right)
\end{array}
Initial program 87.5%
+-commutative87.5%
*-commutative87.5%
distribute-lft-out--88.3%
distribute-lft-out89.8%
distribute-lft-out--100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (+ d4 d2))) (t_1 (* d1 (- d3))) (t_2 (* d1 (- d2 d1))))
(if (<= d3 -2.2e+156)
t_1
(if (<= d3 -7.6e-43)
t_2
(if (<= d3 -5.8e-300)
t_0
(if (<= d3 1.8e-215) t_2 (if (<= d3 2.8e+135) t_0 t_1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 + d2);
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 - d1);
double tmp;
if (d3 <= -2.2e+156) {
tmp = t_1;
} else if (d3 <= -7.6e-43) {
tmp = t_2;
} else if (d3 <= -5.8e-300) {
tmp = t_0;
} else if (d3 <= 1.8e-215) {
tmp = t_2;
} else if (d3 <= 2.8e+135) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = d1 * (d4 + d2)
t_1 = d1 * -d3
t_2 = d1 * (d2 - d1)
if (d3 <= (-2.2d+156)) then
tmp = t_1
else if (d3 <= (-7.6d-43)) then
tmp = t_2
else if (d3 <= (-5.8d-300)) then
tmp = t_0
else if (d3 <= 1.8d-215) then
tmp = t_2
else if (d3 <= 2.8d+135) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 + d2);
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 - d1);
double tmp;
if (d3 <= -2.2e+156) {
tmp = t_1;
} else if (d3 <= -7.6e-43) {
tmp = t_2;
} else if (d3 <= -5.8e-300) {
tmp = t_0;
} else if (d3 <= 1.8e-215) {
tmp = t_2;
} else if (d3 <= 2.8e+135) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 + d2) t_1 = d1 * -d3 t_2 = d1 * (d2 - d1) tmp = 0 if d3 <= -2.2e+156: tmp = t_1 elif d3 <= -7.6e-43: tmp = t_2 elif d3 <= -5.8e-300: tmp = t_0 elif d3 <= 1.8e-215: tmp = t_2 elif d3 <= 2.8e+135: tmp = t_0 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 + d2)) t_1 = Float64(d1 * Float64(-d3)) t_2 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d3 <= -2.2e+156) tmp = t_1; elseif (d3 <= -7.6e-43) tmp = t_2; elseif (d3 <= -5.8e-300) tmp = t_0; elseif (d3 <= 1.8e-215) tmp = t_2; elseif (d3 <= 2.8e+135) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 + d2); t_1 = d1 * -d3; t_2 = d1 * (d2 - d1); tmp = 0.0; if (d3 <= -2.2e+156) tmp = t_1; elseif (d3 <= -7.6e-43) tmp = t_2; elseif (d3 <= -5.8e-300) tmp = t_0; elseif (d3 <= 1.8e-215) tmp = t_2; elseif (d3 <= 2.8e+135) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -2.2e+156], t$95$1, If[LessEqual[d3, -7.6e-43], t$95$2, If[LessEqual[d3, -5.8e-300], t$95$0, If[LessEqual[d3, 1.8e-215], t$95$2, If[LessEqual[d3, 2.8e+135], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 + d2\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
t_2 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d3 \leq -2.2 \cdot 10^{+156}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq -7.6 \cdot 10^{-43}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq -5.8 \cdot 10^{-300}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 1.8 \cdot 10^{-215}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 2.8 \cdot 10^{+135}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d3 < -2.20000000000000004e156 or 2.80000000000000002e135 < d3 Initial program 83.1%
+-commutative83.1%
*-commutative83.1%
distribute-lft-out--86.2%
distribute-lft-out87.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 79.7%
mul-1-neg79.7%
distribute-rgt-neg-out79.7%
Simplified79.7%
if -2.20000000000000004e156 < d3 < -7.59999999999999939e-43 or -5.79999999999999985e-300 < d3 < 1.7999999999999999e-215Initial program 92.9%
+-commutative92.9%
*-commutative92.9%
distribute-lft-out--92.9%
distribute-lft-out92.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 76.5%
+-commutative76.5%
associate--l-76.5%
Simplified76.5%
Taylor expanded in d3 around 0 56.7%
if -7.59999999999999939e-43 < d3 < -5.79999999999999985e-300 or 1.7999999999999999e-215 < d3 < 2.80000000000000002e135Initial program 87.4%
+-commutative87.4%
*-commutative87.4%
distribute-lft-out--87.4%
distribute-lft-out89.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.7%
Taylor expanded in d1 around 0 75.6%
Final simplification72.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -2.4e-41)
t_0
(if (<= d3 -2.1e-302)
t_1
(if (<= d3 9e-216)
(* d1 (- d2 d1))
(if (<= d3 2.2e+26)
t_1
(if (<= d3 6.6e+106) (* d1 (- d4 d1)) 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 <= -2.4e-41) {
tmp = t_0;
} else if (d3 <= -2.1e-302) {
tmp = t_1;
} else if (d3 <= 9e-216) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 2.2e+26) {
tmp = t_1;
} else if (d3 <= 6.6e+106) {
tmp = d1 * (d4 - d1);
} 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 <= (-2.4d-41)) then
tmp = t_0
else if (d3 <= (-2.1d-302)) then
tmp = t_1
else if (d3 <= 9d-216) then
tmp = d1 * (d2 - d1)
else if (d3 <= 2.2d+26) then
tmp = t_1
else if (d3 <= 6.6d+106) then
tmp = d1 * (d4 - d1)
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 <= -2.4e-41) {
tmp = t_0;
} else if (d3 <= -2.1e-302) {
tmp = t_1;
} else if (d3 <= 9e-216) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 2.2e+26) {
tmp = t_1;
} else if (d3 <= 6.6e+106) {
tmp = d1 * (d4 - d1);
} 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 <= -2.4e-41: tmp = t_0 elif d3 <= -2.1e-302: tmp = t_1 elif d3 <= 9e-216: tmp = d1 * (d2 - d1) elif d3 <= 2.2e+26: tmp = t_1 elif d3 <= 6.6e+106: tmp = d1 * (d4 - d1) 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 <= -2.4e-41) tmp = t_0; elseif (d3 <= -2.1e-302) tmp = t_1; elseif (d3 <= 9e-216) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 2.2e+26) tmp = t_1; elseif (d3 <= 6.6e+106) tmp = Float64(d1 * Float64(d4 - d1)); 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 <= -2.4e-41) tmp = t_0; elseif (d3 <= -2.1e-302) tmp = t_1; elseif (d3 <= 9e-216) tmp = d1 * (d2 - d1); elseif (d3 <= 2.2e+26) tmp = t_1; elseif (d3 <= 6.6e+106) tmp = d1 * (d4 - d1); 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, -2.4e-41], t$95$0, If[LessEqual[d3, -2.1e-302], t$95$1, If[LessEqual[d3, 9e-216], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.2e+26], t$95$1, If[LessEqual[d3, 6.6e+106], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], 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 -2.4 \cdot 10^{-41}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq -2.1 \cdot 10^{-302}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq 9 \cdot 10^{-216}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 2.2 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq 6.6 \cdot 10^{+106}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -2.40000000000000022e-41 or 6.60000000000000015e106 < d3 Initial program 85.2%
+-commutative85.2%
*-commutative85.2%
distribute-lft-out--87.0%
distribute-lft-out88.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.5%
+-commutative86.5%
associate--l-86.5%
Simplified86.5%
Taylor expanded in d1 around 0 75.3%
if -2.40000000000000022e-41 < d3 < -2.10000000000000013e-302 or 8.9999999999999997e-216 < d3 < 2.20000000000000007e26Initial program 90.2%
+-commutative90.2%
*-commutative90.2%
distribute-lft-out--90.2%
distribute-lft-out91.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.5%
Taylor expanded in d1 around 0 80.3%
if -2.10000000000000013e-302 < d3 < 8.9999999999999997e-216Initial program 87.0%
+-commutative87.0%
*-commutative87.0%
distribute-lft-out--87.0%
distribute-lft-out87.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 80.4%
+-commutative80.4%
associate--l-80.4%
Simplified80.4%
Taylor expanded in d3 around 0 80.4%
if 2.20000000000000007e26 < d3 < 6.60000000000000015e106Initial program 86.9%
+-commutative86.9%
*-commutative86.9%
distribute-lft-out--86.9%
distribute-lft-out91.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 90.1%
Taylor expanded in d2 around 0 77.5%
Final simplification78.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d1))) (t_1 (* d1 (- (- d1) d3))))
(if (<= d2 -2.15e+49)
(* d1 (- d2 d3))
(if (<= d2 -6e-159)
t_1
(if (<= d2 -1.95e-243)
t_0
(if (<= d2 2.95e-254)
t_1
(if (<= d2 5.5e-101) (* d1 (- d4 d3)) t_0)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d1);
double t_1 = d1 * (-d1 - d3);
double tmp;
if (d2 <= -2.15e+49) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -6e-159) {
tmp = t_1;
} else if (d2 <= -1.95e-243) {
tmp = t_0;
} else if (d2 <= 2.95e-254) {
tmp = t_1;
} else if (d2 <= 5.5e-101) {
tmp = d1 * (d4 - d3);
} 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 * (d4 - d1)
t_1 = d1 * (-d1 - d3)
if (d2 <= (-2.15d+49)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-6d-159)) then
tmp = t_1
else if (d2 <= (-1.95d-243)) then
tmp = t_0
else if (d2 <= 2.95d-254) then
tmp = t_1
else if (d2 <= 5.5d-101) then
tmp = d1 * (d4 - d3)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d1);
double t_1 = d1 * (-d1 - d3);
double tmp;
if (d2 <= -2.15e+49) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -6e-159) {
tmp = t_1;
} else if (d2 <= -1.95e-243) {
tmp = t_0;
} else if (d2 <= 2.95e-254) {
tmp = t_1;
} else if (d2 <= 5.5e-101) {
tmp = d1 * (d4 - d3);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d1) t_1 = d1 * (-d1 - d3) tmp = 0 if d2 <= -2.15e+49: tmp = d1 * (d2 - d3) elif d2 <= -6e-159: tmp = t_1 elif d2 <= -1.95e-243: tmp = t_0 elif d2 <= 2.95e-254: tmp = t_1 elif d2 <= 5.5e-101: tmp = d1 * (d4 - d3) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d1)) t_1 = Float64(d1 * Float64(Float64(-d1) - d3)) tmp = 0.0 if (d2 <= -2.15e+49) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -6e-159) tmp = t_1; elseif (d2 <= -1.95e-243) tmp = t_0; elseif (d2 <= 2.95e-254) tmp = t_1; elseif (d2 <= 5.5e-101) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d1); t_1 = d1 * (-d1 - d3); tmp = 0.0; if (d2 <= -2.15e+49) tmp = d1 * (d2 - d3); elseif (d2 <= -6e-159) tmp = t_1; elseif (d2 <= -1.95e-243) tmp = t_0; elseif (d2 <= 2.95e-254) tmp = t_1; elseif (d2 <= 5.5e-101) tmp = d1 * (d4 - d3); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -2.15e+49], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -6e-159], t$95$1, If[LessEqual[d2, -1.95e-243], t$95$0, If[LessEqual[d2, 2.95e-254], t$95$1, If[LessEqual[d2, 5.5e-101], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d1\right)\\
t_1 := d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{if}\;d2 \leq -2.15 \cdot 10^{+49}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -6 \cdot 10^{-159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d2 \leq -1.95 \cdot 10^{-243}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq 2.95 \cdot 10^{-254}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d2 \leq 5.5 \cdot 10^{-101}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d2 < -2.15e49Initial program 86.9%
+-commutative86.9%
*-commutative86.9%
distribute-lft-out--86.9%
distribute-lft-out86.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 83.1%
+-commutative83.1%
associate--l-83.1%
Simplified83.1%
Taylor expanded in d1 around 0 73.4%
if -2.15e49 < d2 < -6.00000000000000018e-159 or -1.95000000000000008e-243 < d2 < 2.9499999999999999e-254Initial program 91.3%
+-commutative91.3%
*-commutative91.3%
distribute-lft-out--91.3%
distribute-lft-out91.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.4%
+-commutative81.4%
associate--l-81.4%
Simplified81.4%
Taylor expanded in d2 around 0 75.0%
associate-*r*75.0%
neg-mul-175.0%
Simplified75.0%
if -6.00000000000000018e-159 < d2 < -1.95000000000000008e-243 or 5.49999999999999973e-101 < d2 Initial program 82.6%
+-commutative82.6%
*-commutative82.6%
distribute-lft-out--84.8%
distribute-lft-out88.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 85.6%
Taylor expanded in d2 around 0 57.6%
if 2.9499999999999999e-254 < d2 < 5.49999999999999973e-101Initial program 94.1%
+-commutative94.1%
*-commutative94.1%
distribute-lft-out--94.1%
distribute-lft-out97.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.9%
Final simplification69.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (or (<= d3 -4.25e+155)
(and (not (<= d3 -3.2e+86))
(or (<= d3 -1.2e+35) (not (<= d3 9e+135)))))
(* d1 (- d3))
(* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -4.25e+155) || (!(d3 <= -3.2e+86) && ((d3 <= -1.2e+35) || !(d3 <= 9e+135)))) {
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.25d+155)) .or. (.not. (d3 <= (-3.2d+86))) .and. (d3 <= (-1.2d+35)) .or. (.not. (d3 <= 9d+135))) 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.25e+155) || (!(d3 <= -3.2e+86) && ((d3 <= -1.2e+35) || !(d3 <= 9e+135)))) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -4.25e+155) or (not (d3 <= -3.2e+86) and ((d3 <= -1.2e+35) or not (d3 <= 9e+135))): tmp = d1 * -d3 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -4.25e+155) || (!(d3 <= -3.2e+86) && ((d3 <= -1.2e+35) || !(d3 <= 9e+135)))) 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.25e+155) || (~((d3 <= -3.2e+86)) && ((d3 <= -1.2e+35) || ~((d3 <= 9e+135))))) tmp = d1 * -d3; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -4.25e+155], And[N[Not[LessEqual[d3, -3.2e+86]], $MachinePrecision], Or[LessEqual[d3, -1.2e+35], N[Not[LessEqual[d3, 9e+135]], $MachinePrecision]]]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -4.25 \cdot 10^{+155} \lor \neg \left(d3 \leq -3.2 \cdot 10^{+86}\right) \land \left(d3 \leq -1.2 \cdot 10^{+35} \lor \neg \left(d3 \leq 9 \cdot 10^{+135}\right)\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d3 < -4.2500000000000001e155 or -3.2e86 < d3 < -1.20000000000000007e35 or 9.00000000000000014e135 < d3 Initial program 84.9%
+-commutative84.9%
*-commutative84.9%
distribute-lft-out--87.7%
distribute-lft-out89.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 78.8%
mul-1-neg78.8%
distribute-rgt-neg-out78.8%
Simplified78.8%
if -4.2500000000000001e155 < d3 < -3.2e86 or -1.20000000000000007e35 < d3 < 9.00000000000000014e135Initial program 88.5%
+-commutative88.5%
*-commutative88.5%
distribute-lft-out--88.5%
distribute-lft-out90.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.4%
Taylor expanded in d1 around 0 69.4%
Final simplification72.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -2.4e-41)
t_0
(if (<= d3 -8.5e-302)
t_1
(if (<= d3 1.25e-215)
(* d1 (- d2 d1))
(if (<= d3 4.7e+126) 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 <= -2.4e-41) {
tmp = t_0;
} else if (d3 <= -8.5e-302) {
tmp = t_1;
} else if (d3 <= 1.25e-215) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 4.7e+126) {
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 <= (-2.4d-41)) then
tmp = t_0
else if (d3 <= (-8.5d-302)) then
tmp = t_1
else if (d3 <= 1.25d-215) then
tmp = d1 * (d2 - d1)
else if (d3 <= 4.7d+126) 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 <= -2.4e-41) {
tmp = t_0;
} else if (d3 <= -8.5e-302) {
tmp = t_1;
} else if (d3 <= 1.25e-215) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 4.7e+126) {
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 <= -2.4e-41: tmp = t_0 elif d3 <= -8.5e-302: tmp = t_1 elif d3 <= 1.25e-215: tmp = d1 * (d2 - d1) elif d3 <= 4.7e+126: 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 <= -2.4e-41) tmp = t_0; elseif (d3 <= -8.5e-302) tmp = t_1; elseif (d3 <= 1.25e-215) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 4.7e+126) 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 <= -2.4e-41) tmp = t_0; elseif (d3 <= -8.5e-302) tmp = t_1; elseif (d3 <= 1.25e-215) tmp = d1 * (d2 - d1); elseif (d3 <= 4.7e+126) 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, -2.4e-41], t$95$0, If[LessEqual[d3, -8.5e-302], t$95$1, If[LessEqual[d3, 1.25e-215], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 4.7e+126], 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 -2.4 \cdot 10^{-41}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq -8.5 \cdot 10^{-302}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq 1.25 \cdot 10^{-215}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 4.7 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -2.40000000000000022e-41 or 4.6999999999999999e126 < d3 Initial program 88.0%
+-commutative88.0%
*-commutative88.0%
distribute-lft-out--90.0%
distribute-lft-out91.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.5%
+-commutative85.5%
associate--l-85.5%
Simplified85.5%
Taylor expanded in d1 around 0 75.3%
if -2.40000000000000022e-41 < d3 < -8.5000000000000005e-302 or 1.24999999999999989e-215 < d3 < 4.6999999999999999e126Initial program 87.2%
+-commutative87.2%
*-commutative87.2%
distribute-lft-out--87.2%
distribute-lft-out89.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.7%
Taylor expanded in d1 around 0 75.4%
if -8.5000000000000005e-302 < d3 < 1.24999999999999989e-215Initial program 87.0%
+-commutative87.0%
*-commutative87.0%
distribute-lft-out--87.0%
distribute-lft-out87.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 80.4%
+-commutative80.4%
associate--l-80.4%
Simplified80.4%
Taylor expanded in d3 around 0 80.4%
Final simplification75.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.7e+64)
(* d1 d2)
(if (or (<= d2 -6.8e-199) (and (not (<= d2 -1.15e-248)) (<= d2 8.8e-157)))
(* d1 (- d3))
(* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.7e+64) {
tmp = d1 * d2;
} else if ((d2 <= -6.8e-199) || (!(d2 <= -1.15e-248) && (d2 <= 8.8e-157))) {
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.7d+64)) then
tmp = d1 * d2
else if ((d2 <= (-6.8d-199)) .or. (.not. (d2 <= (-1.15d-248))) .and. (d2 <= 8.8d-157)) 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.7e+64) {
tmp = d1 * d2;
} else if ((d2 <= -6.8e-199) || (!(d2 <= -1.15e-248) && (d2 <= 8.8e-157))) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.7e+64: tmp = d1 * d2 elif (d2 <= -6.8e-199) or (not (d2 <= -1.15e-248) and (d2 <= 8.8e-157)): tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.7e+64) tmp = Float64(d1 * d2); elseif ((d2 <= -6.8e-199) || (!(d2 <= -1.15e-248) && (d2 <= 8.8e-157))) 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.7e+64) tmp = d1 * d2; elseif ((d2 <= -6.8e-199) || (~((d2 <= -1.15e-248)) && (d2 <= 8.8e-157))) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.7e+64], N[(d1 * d2), $MachinePrecision], If[Or[LessEqual[d2, -6.8e-199], And[N[Not[LessEqual[d2, -1.15e-248]], $MachinePrecision], LessEqual[d2, 8.8e-157]]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.7 \cdot 10^{+64}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -6.8 \cdot 10^{-199} \lor \neg \left(d2 \leq -1.15 \cdot 10^{-248}\right) \land d2 \leq 8.8 \cdot 10^{-157}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.7000000000000001e64Initial program 87.9%
+-commutative87.9%
*-commutative87.9%
distribute-lft-out--87.9%
distribute-lft-out87.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 60.8%
if -1.7000000000000001e64 < d2 < -6.80000000000000011e-199 or -1.15e-248 < d2 < 8.80000000000000041e-157Initial program 91.1%
+-commutative91.1%
*-commutative91.1%
distribute-lft-out--91.1%
distribute-lft-out91.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 44.1%
mul-1-neg44.1%
distribute-rgt-neg-out44.1%
Simplified44.1%
if -6.80000000000000011e-199 < d2 < -1.15e-248 or 8.80000000000000041e-157 < d2 Initial program 83.5%
+-commutative83.5%
*-commutative83.5%
distribute-lft-out--85.6%
distribute-lft-out89.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 34.9%
Final simplification44.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.95e-13) (not (<= d3 3.8e+126))) (* d1 (- d2 d3)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.95e-13) || !(d3 <= 3.8e+126)) {
tmp = d1 * (d2 - 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 <= (-1.95d-13)) .or. (.not. (d3 <= 3.8d+126))) then
tmp = d1 * (d2 - 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 <= -1.95e-13) || !(d3 <= 3.8e+126)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.95e-13) or not (d3 <= 3.8e+126): tmp = d1 * (d2 - d3) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.95e-13) || !(d3 <= 3.8e+126)) tmp = Float64(d1 * Float64(d2 - 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 <= -1.95e-13) || ~((d3 <= 3.8e+126))) tmp = d1 * (d2 - d3); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.95e-13], N[Not[LessEqual[d3, 3.8e+126]], $MachinePrecision]], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.95 \cdot 10^{-13} \lor \neg \left(d3 \leq 3.8 \cdot 10^{+126}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -1.95000000000000002e-13 or 3.80000000000000017e126 < d3 Initial program 88.3%
+-commutative88.3%
*-commutative88.3%
distribute-lft-out--90.4%
distribute-lft-out91.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.6%
+-commutative85.6%
associate--l-85.6%
Simplified85.6%
Taylor expanded in d1 around 0 79.1%
if -1.95000000000000002e-13 < d3 < 3.80000000000000017e126Initial program 87.0%
+-commutative87.0%
*-commutative87.0%
distribute-lft-out--87.0%
distribute-lft-out88.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.9%
Final simplification89.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -8.4e-32) (not (<= d3 2.45e+100))) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -8.4e-32) || !(d3 <= 2.45e+100)) {
tmp = d1 * ((d2 - d3) - d1);
} 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 <= (-8.4d-32)) .or. (.not. (d3 <= 2.45d+100))) then
tmp = d1 * ((d2 - d3) - d1)
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 <= -8.4e-32) || !(d3 <= 2.45e+100)) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -8.4e-32) or not (d3 <= 2.45e+100): tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -8.4e-32) || !(d3 <= 2.45e+100)) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); 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 <= -8.4e-32) || ~((d3 <= 2.45e+100))) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -8.4e-32], N[Not[LessEqual[d3, 2.45e+100]], $MachinePrecision]], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -8.4 \cdot 10^{-32} \lor \neg \left(d3 \leq 2.45 \cdot 10^{+100}\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -8.3999999999999996e-32 or 2.44999999999999983e100 < d3 Initial program 84.4%
+-commutative84.4%
*-commutative84.4%
distribute-lft-out--86.2%
distribute-lft-out88.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.7%
+-commutative86.7%
associate--l-86.7%
Simplified86.7%
if -8.3999999999999996e-32 < d3 < 2.44999999999999983e100Initial program 89.8%
+-commutative89.8%
*-commutative89.8%
distribute-lft-out--89.8%
distribute-lft-out91.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.4%
Final simplification92.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.4e-49) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d1) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.4e-49) {
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 (d2 <= (-1.4d-49)) 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 (d2 <= -1.4e-49) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.4e-49: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.4e-49) 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 (d2 <= -1.4e-49) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.4e-49], 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}\;d2 \leq -1.4 \cdot 10^{-49}:\\
\;\;\;\;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 d2 < -1.39999999999999999e-49Initial program 86.6%
+-commutative86.6%
*-commutative86.6%
distribute-lft-out--86.6%
distribute-lft-out86.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.8%
+-commutative82.8%
associate--l-82.8%
Simplified82.8%
if -1.39999999999999999e-49 < d2 Initial program 87.9%
+-commutative87.9%
*-commutative87.9%
distribute-lft-out--89.1%
distribute-lft-out91.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 84.9%
associate--r+84.9%
Simplified84.9%
Final simplification84.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.3e-49) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.3e-49) {
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 <= (-1.3d-49)) 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 <= -1.3e-49) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.3e-49: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.3e-49) 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 <= -1.3e-49) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.3e-49], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.3 \cdot 10^{-49}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.29999999999999997e-49Initial program 86.6%
+-commutative86.6%
*-commutative86.6%
distribute-lft-out--86.6%
distribute-lft-out86.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 49.5%
if -1.29999999999999997e-49 < d2 Initial program 87.9%
+-commutative87.9%
*-commutative87.9%
distribute-lft-out--89.1%
distribute-lft-out91.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 35.0%
Final simplification39.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d2
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 87.5%
+-commutative87.5%
*-commutative87.5%
distribute-lft-out--88.3%
distribute-lft-out89.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.7%
Final simplification31.7%
(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 2024095
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))