
(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 (+ d4 (- d2 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
return d1 * (d4 + (d2 - (d1 + 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 * (d4 + (d2 - (d1 + d3)))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (d4 + (d2 - (d1 + d3)));
}
def code(d1, d2, d3, d4): return d1 * (d4 + (d2 - (d1 + d3)))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(d4 + Float64(d2 - Float64(d1 + d3)))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (d4 + (d2 - (d1 + d3))); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(d4 + N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d4 + \left(d2 - \left(d1 + d3\right)\right)\right)
\end{array}
Initial program 85.1%
+-commutative85.1%
associate--l+85.1%
distribute-lft-out--86.3%
distribute-lft-out--94.5%
*-commutative94.5%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d1 (+ d4 d2))))
(if (<= d1 -7e+156)
t_0
(if (<= d1 -4e+101)
t_1
(if (<= d1 -1.95e+54)
t_0
(if (<= d1 -6.8e-144)
t_1
(if (<= d1 -2.4e-240)
(* d1 (- d3))
(if (<= d1 1.08e+176) t_1 t_0))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * (d4 + d2);
double tmp;
if (d1 <= -7e+156) {
tmp = t_0;
} else if (d1 <= -4e+101) {
tmp = t_1;
} else if (d1 <= -1.95e+54) {
tmp = t_0;
} else if (d1 <= -6.8e-144) {
tmp = t_1;
} else if (d1 <= -2.4e-240) {
tmp = d1 * -d3;
} else if (d1 <= 1.08e+176) {
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 * -d1
t_1 = d1 * (d4 + d2)
if (d1 <= (-7d+156)) then
tmp = t_0
else if (d1 <= (-4d+101)) then
tmp = t_1
else if (d1 <= (-1.95d+54)) then
tmp = t_0
else if (d1 <= (-6.8d-144)) then
tmp = t_1
else if (d1 <= (-2.4d-240)) then
tmp = d1 * -d3
else if (d1 <= 1.08d+176) 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 * -d1;
double t_1 = d1 * (d4 + d2);
double tmp;
if (d1 <= -7e+156) {
tmp = t_0;
} else if (d1 <= -4e+101) {
tmp = t_1;
} else if (d1 <= -1.95e+54) {
tmp = t_0;
} else if (d1 <= -6.8e-144) {
tmp = t_1;
} else if (d1 <= -2.4e-240) {
tmp = d1 * -d3;
} else if (d1 <= 1.08e+176) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = d1 * (d4 + d2) tmp = 0 if d1 <= -7e+156: tmp = t_0 elif d1 <= -4e+101: tmp = t_1 elif d1 <= -1.95e+54: tmp = t_0 elif d1 <= -6.8e-144: tmp = t_1 elif d1 <= -2.4e-240: tmp = d1 * -d3 elif d1 <= 1.08e+176: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d1 * Float64(d4 + d2)) tmp = 0.0 if (d1 <= -7e+156) tmp = t_0; elseif (d1 <= -4e+101) tmp = t_1; elseif (d1 <= -1.95e+54) tmp = t_0; elseif (d1 <= -6.8e-144) tmp = t_1; elseif (d1 <= -2.4e-240) tmp = Float64(d1 * Float64(-d3)); elseif (d1 <= 1.08e+176) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = d1 * (d4 + d2); tmp = 0.0; if (d1 <= -7e+156) tmp = t_0; elseif (d1 <= -4e+101) tmp = t_1; elseif (d1 <= -1.95e+54) tmp = t_0; elseif (d1 <= -6.8e-144) tmp = t_1; elseif (d1 <= -2.4e-240) tmp = d1 * -d3; elseif (d1 <= 1.08e+176) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -7e+156], t$95$0, If[LessEqual[d1, -4e+101], t$95$1, If[LessEqual[d1, -1.95e+54], t$95$0, If[LessEqual[d1, -6.8e-144], t$95$1, If[LessEqual[d1, -2.4e-240], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d1, 1.08e+176], t$95$1, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d1 \cdot \left(d4 + d2\right)\\
\mathbf{if}\;d1 \leq -7 \cdot 10^{+156}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq -4 \cdot 10^{+101}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d1 \leq -1.95 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq -6.8 \cdot 10^{-144}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d1 \leq -2.4 \cdot 10^{-240}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d1 \leq 1.08 \cdot 10^{+176}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d1 < -7.0000000000000006e156 or -3.9999999999999999e101 < d1 < -1.9500000000000001e54 or 1.08e176 < d1 Initial program 56.0%
+-commutative56.0%
associate--l+56.0%
distribute-lft-out--60.0%
distribute-lft-out--85.3%
*-commutative85.3%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d1 around inf 88.5%
unpow288.5%
mul-1-neg88.5%
distribute-rgt-neg-out88.5%
Simplified88.5%
if -7.0000000000000006e156 < d1 < -3.9999999999999999e101 or -1.9500000000000001e54 < d1 < -6.80000000000000035e-144 or -2.3999999999999999e-240 < d1 < 1.08e176Initial program 96.8%
+-commutative96.8%
associate--l+96.8%
distribute-lft-out--96.8%
distribute-lft-out--98.1%
*-commutative98.1%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d2 around inf 64.7%
if -6.80000000000000035e-144 < d1 < -2.3999999999999999e-240Initial program 99.9%
+-commutative99.9%
associate--l+99.9%
distribute-lft-out--99.9%
distribute-lft-out--99.9%
*-commutative99.9%
distribute-lft-out99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d3 around inf 72.3%
mul-1-neg72.3%
distribute-rgt-neg-out72.3%
Simplified72.3%
Final simplification72.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (- d1))))
(if (<= d3 -4.2e+88)
t_0
(if (<= d3 -5.2e-150)
t_1
(if (<= d3 2.1e-211)
(* d1 d2)
(if (<= d3 4e-88) t_1 (if (<= d3 6e+92) (* d1 d4) t_0)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * -d1;
double tmp;
if (d3 <= -4.2e+88) {
tmp = t_0;
} else if (d3 <= -5.2e-150) {
tmp = t_1;
} else if (d3 <= 2.1e-211) {
tmp = d1 * d2;
} else if (d3 <= 4e-88) {
tmp = t_1;
} else if (d3 <= 6e+92) {
tmp = d1 * d4;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * -d3
t_1 = d1 * -d1
if (d3 <= (-4.2d+88)) then
tmp = t_0
else if (d3 <= (-5.2d-150)) then
tmp = t_1
else if (d3 <= 2.1d-211) then
tmp = d1 * d2
else if (d3 <= 4d-88) then
tmp = t_1
else if (d3 <= 6d+92) then
tmp = d1 * d4
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * -d1;
double tmp;
if (d3 <= -4.2e+88) {
tmp = t_0;
} else if (d3 <= -5.2e-150) {
tmp = t_1;
} else if (d3 <= 2.1e-211) {
tmp = d1 * d2;
} else if (d3 <= 4e-88) {
tmp = t_1;
} else if (d3 <= 6e+92) {
tmp = d1 * d4;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * -d1 tmp = 0 if d3 <= -4.2e+88: tmp = t_0 elif d3 <= -5.2e-150: tmp = t_1 elif d3 <= 2.1e-211: tmp = d1 * d2 elif d3 <= 4e-88: tmp = t_1 elif d3 <= 6e+92: tmp = d1 * d4 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) t_1 = Float64(d1 * Float64(-d1)) tmp = 0.0 if (d3 <= -4.2e+88) tmp = t_0; elseif (d3 <= -5.2e-150) tmp = t_1; elseif (d3 <= 2.1e-211) tmp = Float64(d1 * d2); elseif (d3 <= 4e-88) tmp = t_1; elseif (d3 <= 6e+92) tmp = Float64(d1 * d4); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; t_1 = d1 * -d1; tmp = 0.0; if (d3 <= -4.2e+88) tmp = t_0; elseif (d3 <= -5.2e-150) tmp = t_1; elseif (d3 <= 2.1e-211) tmp = d1 * d2; elseif (d3 <= 4e-88) tmp = t_1; elseif (d3 <= 6e+92) tmp = d1 * d4; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * (-d1)), $MachinePrecision]}, If[LessEqual[d3, -4.2e+88], t$95$0, If[LessEqual[d3, -5.2e-150], t$95$1, If[LessEqual[d3, 2.1e-211], N[(d1 * d2), $MachinePrecision], If[LessEqual[d3, 4e-88], t$95$1, If[LessEqual[d3, 6e+92], N[(d1 * d4), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(-d1\right)\\
\mathbf{if}\;d3 \leq -4.2 \cdot 10^{+88}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -5.2 \cdot 10^{-150}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 2.1 \cdot 10^{-211}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d3 \leq 4 \cdot 10^{-88}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 6 \cdot 10^{+92}:\\
\;\;\;\;d1 \cdot d4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -4.2e88 or 6.00000000000000026e92 < d3 Initial program 81.2%
+-commutative81.2%
associate--l+81.2%
distribute-lft-out--84.3%
distribute-lft-out--93.7%
*-commutative93.7%
distribute-lft-out99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d3 around inf 70.1%
mul-1-neg70.1%
distribute-rgt-neg-out70.1%
Simplified70.1%
if -4.2e88 < d3 < -5.1999999999999995e-150 or 2.10000000000000008e-211 < d3 < 3.99999999999999974e-88Initial program 81.3%
+-commutative81.3%
associate--l+81.3%
distribute-lft-out--81.3%
distribute-lft-out--92.2%
*-commutative92.2%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d1 around inf 58.8%
unpow258.8%
mul-1-neg58.8%
distribute-rgt-neg-out58.8%
Simplified58.8%
if -5.1999999999999995e-150 < d3 < 2.10000000000000008e-211Initial program 96.1%
+-commutative96.1%
associate--l+96.1%
distribute-lft-out--96.1%
distribute-lft-out--100.0%
*-commutative100.0%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d2 around inf 37.2%
if 3.99999999999999974e-88 < d3 < 6.00000000000000026e92Initial program 86.7%
+-commutative86.7%
associate--l+86.7%
distribute-lft-out--86.7%
distribute-lft-out--93.3%
*-commutative93.3%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around inf 30.9%
Final simplification53.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d1))) (t_1 (* d1 (+ d4 d2))))
(if (<= d1 -3.1e+54)
t_0
(if (<= d1 -4.5e-144)
t_1
(if (<= d1 -4.1e-240) (* d1 (- d3)) (if (<= d1 5.6e+102) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d1);
double t_1 = d1 * (d4 + d2);
double tmp;
if (d1 <= -3.1e+54) {
tmp = t_0;
} else if (d1 <= -4.5e-144) {
tmp = t_1;
} else if (d1 <= -4.1e-240) {
tmp = d1 * -d3;
} else if (d1 <= 5.6e+102) {
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 * (d4 - d1)
t_1 = d1 * (d4 + d2)
if (d1 <= (-3.1d+54)) then
tmp = t_0
else if (d1 <= (-4.5d-144)) then
tmp = t_1
else if (d1 <= (-4.1d-240)) then
tmp = d1 * -d3
else if (d1 <= 5.6d+102) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d1);
double t_1 = d1 * (d4 + d2);
double tmp;
if (d1 <= -3.1e+54) {
tmp = t_0;
} else if (d1 <= -4.5e-144) {
tmp = t_1;
} else if (d1 <= -4.1e-240) {
tmp = d1 * -d3;
} else if (d1 <= 5.6e+102) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d1) t_1 = d1 * (d4 + d2) tmp = 0 if d1 <= -3.1e+54: tmp = t_0 elif d1 <= -4.5e-144: tmp = t_1 elif d1 <= -4.1e-240: tmp = d1 * -d3 elif d1 <= 5.6e+102: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d1)) t_1 = Float64(d1 * Float64(d4 + d2)) tmp = 0.0 if (d1 <= -3.1e+54) tmp = t_0; elseif (d1 <= -4.5e-144) tmp = t_1; elseif (d1 <= -4.1e-240) tmp = Float64(d1 * Float64(-d3)); elseif (d1 <= 5.6e+102) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d1); t_1 = d1 * (d4 + d2); tmp = 0.0; if (d1 <= -3.1e+54) tmp = t_0; elseif (d1 <= -4.5e-144) tmp = t_1; elseif (d1 <= -4.1e-240) tmp = d1 * -d3; elseif (d1 <= 5.6e+102) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -3.1e+54], t$95$0, If[LessEqual[d1, -4.5e-144], t$95$1, If[LessEqual[d1, -4.1e-240], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d1, 5.6e+102], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d1\right)\\
t_1 := d1 \cdot \left(d4 + d2\right)\\
\mathbf{if}\;d1 \leq -3.1 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq -4.5 \cdot 10^{-144}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d1 \leq -4.1 \cdot 10^{-240}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d1 \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d1 < -3.0999999999999999e54 or 5.60000000000000037e102 < d1 Initial program 62.0%
+-commutative62.0%
associate--l+62.0%
distribute-lft-out--65.0%
distribute-lft-out--86.0%
*-commutative86.0%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d1 around inf 84.3%
neg-mul-184.3%
Simplified84.3%
Taylor expanded in d1 around 0 71.3%
+-commutative71.3%
unpow271.3%
mul-1-neg71.3%
sub-neg71.3%
distribute-lft-out--84.3%
Simplified84.3%
if -3.0999999999999999e54 < d1 < -4.4999999999999998e-144 or -4.1000000000000001e-240 < d1 < 5.60000000000000037e102Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-lft-out--100.0%
*-commutative100.0%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d2 around inf 65.4%
if -4.4999999999999998e-144 < d1 < -4.1000000000000001e-240Initial program 99.9%
+-commutative99.9%
associate--l+99.9%
distribute-lft-out--99.9%
distribute-lft-out--99.9%
*-commutative99.9%
distribute-lft-out99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d3 around inf 72.3%
mul-1-neg72.3%
distribute-rgt-neg-out72.3%
Simplified72.3%
Final simplification73.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d1 -1.3e+46)
t_0
(if (<= d1 9.5e-188)
t_1
(if (<= d1 6.5e-82) (* d1 (- d4 d3)) (if (<= d1 7.5e+122) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d1 <= -1.3e+46) {
tmp = t_0;
} else if (d1 <= 9.5e-188) {
tmp = t_1;
} else if (d1 <= 6.5e-82) {
tmp = d1 * (d4 - d3);
} else if (d1 <= 7.5e+122) {
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 * (d4 - d1)
t_1 = d1 * (d2 - d3)
if (d1 <= (-1.3d+46)) then
tmp = t_0
else if (d1 <= 9.5d-188) then
tmp = t_1
else if (d1 <= 6.5d-82) then
tmp = d1 * (d4 - d3)
else if (d1 <= 7.5d+122) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d1 <= -1.3e+46) {
tmp = t_0;
} else if (d1 <= 9.5e-188) {
tmp = t_1;
} else if (d1 <= 6.5e-82) {
tmp = d1 * (d4 - d3);
} else if (d1 <= 7.5e+122) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d1 <= -1.3e+46: tmp = t_0 elif d1 <= 9.5e-188: tmp = t_1 elif d1 <= 6.5e-82: tmp = d1 * (d4 - d3) elif d1 <= 7.5e+122: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d1 <= -1.3e+46) tmp = t_0; elseif (d1 <= 9.5e-188) tmp = t_1; elseif (d1 <= 6.5e-82) tmp = Float64(d1 * Float64(d4 - d3)); elseif (d1 <= 7.5e+122) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d1); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d1 <= -1.3e+46) tmp = t_0; elseif (d1 <= 9.5e-188) tmp = t_1; elseif (d1 <= 6.5e-82) tmp = d1 * (d4 - d3); elseif (d1 <= 7.5e+122) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -1.3e+46], t$95$0, If[LessEqual[d1, 9.5e-188], t$95$1, If[LessEqual[d1, 6.5e-82], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 7.5e+122], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d1 \leq -1.3 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq 9.5 \cdot 10^{-188}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d1 \leq 6.5 \cdot 10^{-82}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{elif}\;d1 \leq 7.5 \cdot 10^{+122}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d1 < -1.30000000000000007e46 or 7.5000000000000002e122 < d1 Initial program 61.6%
+-commutative61.6%
associate--l+61.6%
distribute-lft-out--64.6%
distribute-lft-out--85.8%
*-commutative85.8%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d1 around inf 84.2%
neg-mul-184.2%
Simplified84.2%
Taylor expanded in d1 around 0 71.1%
+-commutative71.1%
unpow271.1%
mul-1-neg71.1%
sub-neg71.1%
distribute-lft-out--84.2%
Simplified84.2%
if -1.30000000000000007e46 < d1 < 9.50000000000000063e-188 or 6.4999999999999997e-82 < d1 < 7.5000000000000002e122Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-lft-out--100.0%
*-commutative100.0%
distribute-lft-out99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 72.3%
Taylor expanded in d1 around 0 65.6%
if 9.50000000000000063e-188 < d1 < 6.4999999999999997e-82Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-lft-out--100.0%
*-commutative100.0%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d3 around inf 74.6%
neg-mul-174.6%
Simplified74.6%
Taylor expanded in d1 around 0 74.6%
Final simplification73.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -1.25e+46) (not (<= d1 7.3e+124))) (* d1 (- d4 d1)) (* d1 (- d2 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1.25e+46) || !(d1 <= 7.3e+124)) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d1 <= (-1.25d+46)) .or. (.not. (d1 <= 7.3d+124))) then
tmp = d1 * (d4 - d1)
else
tmp = d1 * (d2 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1.25e+46) || !(d1 <= 7.3e+124)) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -1.25e+46) or not (d1 <= 7.3e+124): tmp = d1 * (d4 - d1) else: tmp = d1 * (d2 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -1.25e+46) || !(d1 <= 7.3e+124)) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(d2 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -1.25e+46) || ~((d1 <= 7.3e+124))) tmp = d1 * (d4 - d1); else tmp = d1 * (d2 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -1.25e+46], N[Not[LessEqual[d1, 7.3e+124]], $MachinePrecision]], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -1.25 \cdot 10^{+46} \lor \neg \left(d1 \leq 7.3 \cdot 10^{+124}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\end{array}
\end{array}
if d1 < -1.2500000000000001e46 or 7.29999999999999994e124 < d1 Initial program 61.6%
+-commutative61.6%
associate--l+61.6%
distribute-lft-out--64.6%
distribute-lft-out--85.8%
*-commutative85.8%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d1 around inf 84.2%
neg-mul-184.2%
Simplified84.2%
Taylor expanded in d1 around 0 71.1%
+-commutative71.1%
unpow271.1%
mul-1-neg71.1%
sub-neg71.1%
distribute-lft-out--84.2%
Simplified84.2%
if -1.2500000000000001e46 < d1 < 7.29999999999999994e124Initial program 100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-lft-out--100.0%
*-commutative100.0%
distribute-lft-out99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 72.6%
Taylor expanded in d1 around 0 66.7%
Final simplification73.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 4.6e+110) (* d1 (- d2 (+ d1 d3))) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.6e+110) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 4.6d+110) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.6e+110) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 4.6e+110: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 4.6e+110) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 4.6e+110) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 4.6e+110], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 4.6 \cdot 10^{+110}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 4.6e110Initial program 86.2%
+-commutative86.2%
associate--l+86.2%
distribute-lft-out--87.6%
distribute-lft-out--95.4%
*-commutative95.4%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.5%
if 4.6e110 < d4 Initial program 78.9%
+-commutative78.9%
associate--l+78.9%
distribute-lft-out--78.9%
distribute-lft-out--89.5%
*-commutative89.5%
distribute-lft-out99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d3 around inf 90.0%
neg-mul-190.0%
Simplified90.0%
Taylor expanded in d1 around 0 90.0%
Final simplification87.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.9e-228) (* d1 d2) (if (<= d4 6e+42) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e-228) {
tmp = d1 * d2;
} else if (d4 <= 6e+42) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2.9d-228) then
tmp = d1 * d2
else if (d4 <= 6d+42) then
tmp = d1 * -d1
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.9e-228) {
tmp = d1 * d2;
} else if (d4 <= 6e+42) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.9e-228: tmp = d1 * d2 elif d4 <= 6e+42: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.9e-228) tmp = Float64(d1 * d2); elseif (d4 <= 6e+42) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.9e-228) tmp = d1 * d2; elseif (d4 <= 6e+42) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.9e-228], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 6e+42], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.9 \cdot 10^{-228}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 6 \cdot 10^{+42}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.9000000000000001e-228Initial program 85.5%
+-commutative85.5%
associate--l+85.5%
distribute-lft-out--86.8%
distribute-lft-out--94.7%
*-commutative94.7%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d2 around inf 28.6%
if 2.9000000000000001e-228 < d4 < 6.00000000000000058e42Initial program 91.1%
+-commutative91.1%
associate--l+91.1%
distribute-lft-out--92.9%
distribute-lft-out--98.2%
*-commutative98.2%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d1 around inf 35.6%
unpow235.6%
mul-1-neg35.6%
distribute-rgt-neg-out35.6%
Simplified35.6%
if 6.00000000000000058e42 < d4 Initial program 77.1%
+-commutative77.1%
associate--l+77.1%
distribute-lft-out--77.1%
distribute-lft-out--89.6%
*-commutative89.6%
distribute-lft-out99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around inf 68.4%
Final simplification37.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.8e+35) (* d1 (- d2 d1)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.8e+35) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-2.8d+35)) then
tmp = d1 * (d2 - d1)
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.8e+35) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.8e+35: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.8e+35) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.8e+35) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.8e+35], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.8 \cdot 10^{+35}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -2.79999999999999999e35Initial program 74.6%
+-commutative74.6%
associate--l+74.6%
distribute-lft-out--77.6%
distribute-lft-out--94.0%
*-commutative94.0%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around 0 90.2%
Taylor expanded in d3 around 0 69.9%
if -2.79999999999999999e35 < d2 Initial program 88.9%
+-commutative88.9%
associate--l+88.9%
distribute-lft-out--89.4%
distribute-lft-out--94.7%
*-commutative94.7%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d1 around inf 61.4%
neg-mul-161.4%
Simplified61.4%
Taylor expanded in d1 around 0 57.2%
+-commutative57.2%
unpow257.2%
mul-1-neg57.2%
sub-neg57.2%
distribute-lft-out--61.4%
Simplified61.4%
Final simplification63.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.12e+43) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.12e+43) {
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 <= 1.12d+43) 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 <= 1.12e+43) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.12e+43: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.12e+43) 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 <= 1.12e+43) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.12e+43], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.12 \cdot 10^{+43}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.12e43Initial program 87.0%
+-commutative87.0%
associate--l+87.0%
distribute-lft-out--88.4%
distribute-lft-out--95.6%
*-commutative95.6%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d2 around inf 29.7%
if 1.12e43 < d4 Initial program 77.1%
+-commutative77.1%
associate--l+77.1%
distribute-lft-out--77.1%
distribute-lft-out--89.6%
*-commutative89.6%
distribute-lft-out99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around inf 68.4%
Final simplification37.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d4))
double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
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
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
def code(d1, d2, d3, d4): return d1 * d4
function code(d1, d2, d3, d4) return Float64(d1 * d4) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d4; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d4), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d4
\end{array}
Initial program 85.1%
+-commutative85.1%
associate--l+85.1%
distribute-lft-out--86.3%
distribute-lft-out--94.5%
*-commutative94.5%
distribute-lft-out100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around inf 29.4%
Final simplification29.4%
(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 2023238
(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)))