
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- d2 d1) (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d2 - d1) + (d4 - d3))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d1) + (d4 - d3))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d1) + Float64(d4 - d3))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d1) + (d4 - d3)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d1), $MachinePrecision] + N[(d4 - d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d1\right) + \left(d4 - d3\right)\right)
\end{array}
Initial program 87.5%
sub-neg87.5%
+-commutative87.5%
associate-+r+87.5%
+-commutative87.5%
sub-neg87.5%
+-commutative87.5%
associate-+r+87.5%
sub-neg87.5%
*-commutative87.5%
+-commutative87.5%
unsub-neg87.5%
associate--r-87.5%
distribute-rgt-out--89.4%
*-commutative89.4%
distribute-lft-out--90.6%
distribute-lft-out--100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d3))))
(if (<= d1 -7.8e+78)
(* d1 (- d2 d1))
(if (<= d1 -3.4e-29)
t_0
(if (<= d1 8.4e-305)
(* d1 (+ d2 d4))
(if (<= d1 2.4e-18) t_0 (* d1 (- (- d1) d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double tmp;
if (d1 <= -7.8e+78) {
tmp = d1 * (d2 - d1);
} else if (d1 <= -3.4e-29) {
tmp = t_0;
} else if (d1 <= 8.4e-305) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 2.4e-18) {
tmp = t_0;
} else {
tmp = d1 * (-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) :: t_0
real(8) :: tmp
t_0 = d1 * (d4 - d3)
if (d1 <= (-7.8d+78)) then
tmp = d1 * (d2 - d1)
else if (d1 <= (-3.4d-29)) then
tmp = t_0
else if (d1 <= 8.4d-305) then
tmp = d1 * (d2 + d4)
else if (d1 <= 2.4d-18) then
tmp = t_0
else
tmp = d1 * (-d1 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double tmp;
if (d1 <= -7.8e+78) {
tmp = d1 * (d2 - d1);
} else if (d1 <= -3.4e-29) {
tmp = t_0;
} else if (d1 <= 8.4e-305) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 2.4e-18) {
tmp = t_0;
} else {
tmp = d1 * (-d1 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d3) tmp = 0 if d1 <= -7.8e+78: tmp = d1 * (d2 - d1) elif d1 <= -3.4e-29: tmp = t_0 elif d1 <= 8.4e-305: tmp = d1 * (d2 + d4) elif d1 <= 2.4e-18: tmp = t_0 else: tmp = d1 * (-d1 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d3)) tmp = 0.0 if (d1 <= -7.8e+78) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d1 <= -3.4e-29) tmp = t_0; elseif (d1 <= 8.4e-305) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d1 <= 2.4e-18) tmp = t_0; else tmp = Float64(d1 * Float64(Float64(-d1) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d3); tmp = 0.0; if (d1 <= -7.8e+78) tmp = d1 * (d2 - d1); elseif (d1 <= -3.4e-29) tmp = t_0; elseif (d1 <= 8.4e-305) tmp = d1 * (d2 + d4); elseif (d1 <= 2.4e-18) tmp = t_0; else tmp = d1 * (-d1 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -7.8e+78], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, -3.4e-29], t$95$0, If[LessEqual[d1, 8.4e-305], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 2.4e-18], t$95$0, N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d3\right)\\
\mathbf{if}\;d1 \leq -7.8 \cdot 10^{+78}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d1 \leq -3.4 \cdot 10^{-29}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq 8.4 \cdot 10^{-305}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d1 \leq 2.4 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -7.8000000000000008e78Initial program 69.8%
sub-neg69.8%
+-commutative69.8%
associate-+r+69.8%
+-commutative69.8%
sub-neg69.8%
+-commutative69.8%
associate-+r+69.8%
sub-neg69.8%
*-commutative69.8%
+-commutative69.8%
unsub-neg69.8%
associate--r-69.8%
distribute-rgt-out--75.5%
*-commutative75.5%
distribute-lft-out--77.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.5%
Taylor expanded in d4 around 0 72.8%
if -7.8000000000000008e78 < d1 < -3.39999999999999972e-29 or 8.3999999999999999e-305 < d1 < 2.39999999999999994e-18Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
*-commutative100.0%
+-commutative100.0%
unsub-neg100.0%
associate--r-100.0%
distribute-rgt-out--100.0%
*-commutative100.0%
distribute-lft-out--100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 71.7%
+-commutative71.7%
associate--r+71.7%
Simplified71.7%
Taylor expanded in d1 around 0 69.0%
if -3.39999999999999972e-29 < d1 < 8.3999999999999999e-305Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
*-commutative100.0%
+-commutative100.0%
unsub-neg100.0%
associate--r-100.0%
distribute-rgt-out--100.0%
*-commutative100.0%
distribute-lft-out--99.9%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d3 around 0 79.2%
Taylor expanded in d1 around 0 74.1%
if 2.39999999999999994e-18 < d1 Initial program 71.4%
sub-neg71.4%
+-commutative71.4%
associate-+r+71.4%
+-commutative71.4%
sub-neg71.4%
+-commutative71.4%
associate-+r+71.4%
sub-neg71.4%
*-commutative71.4%
+-commutative71.4%
unsub-neg71.4%
associate--r-71.4%
distribute-rgt-out--75.0%
*-commutative75.0%
distribute-lft-out--78.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 88.3%
+-commutative88.3%
associate--r+88.3%
Simplified88.3%
Taylor expanded in d4 around 0 81.0%
associate-*r*81.0%
neg-mul-181.0%
Simplified81.0%
Final simplification73.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d4 d3))))
(if (<= d1 -8e+78)
t_0
(if (<= d1 -8.5e-29)
t_1
(if (<= d1 1.2e-306) (* d1 (+ d2 d4)) (if (<= d1 2.55e+50) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d4 - d3);
double tmp;
if (d1 <= -8e+78) {
tmp = t_0;
} else if (d1 <= -8.5e-29) {
tmp = t_1;
} else if (d1 <= 1.2e-306) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 2.55e+50) {
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 - d1)
t_1 = d1 * (d4 - d3)
if (d1 <= (-8d+78)) then
tmp = t_0
else if (d1 <= (-8.5d-29)) then
tmp = t_1
else if (d1 <= 1.2d-306) then
tmp = d1 * (d2 + d4)
else if (d1 <= 2.55d+50) 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 - d1);
double t_1 = d1 * (d4 - d3);
double tmp;
if (d1 <= -8e+78) {
tmp = t_0;
} else if (d1 <= -8.5e-29) {
tmp = t_1;
} else if (d1 <= 1.2e-306) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 2.55e+50) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d4 - d3) tmp = 0 if d1 <= -8e+78: tmp = t_0 elif d1 <= -8.5e-29: tmp = t_1 elif d1 <= 1.2e-306: tmp = d1 * (d2 + d4) elif d1 <= 2.55e+50: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d4 - d3)) tmp = 0.0 if (d1 <= -8e+78) tmp = t_0; elseif (d1 <= -8.5e-29) tmp = t_1; elseif (d1 <= 1.2e-306) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d1 <= 2.55e+50) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d4 - d3); tmp = 0.0; if (d1 <= -8e+78) tmp = t_0; elseif (d1 <= -8.5e-29) tmp = t_1; elseif (d1 <= 1.2e-306) tmp = d1 * (d2 + d4); elseif (d1 <= 2.55e+50) 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 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -8e+78], t$95$0, If[LessEqual[d1, -8.5e-29], t$95$1, If[LessEqual[d1, 1.2e-306], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 2.55e+50], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d4 - d3\right)\\
\mathbf{if}\;d1 \leq -8 \cdot 10^{+78}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq -8.5 \cdot 10^{-29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d1 \leq 1.2 \cdot 10^{-306}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d1 \leq 2.55 \cdot 10^{+50}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d1 < -8.00000000000000007e78 or 2.5499999999999999e50 < d1 Initial program 68.3%
sub-neg68.3%
+-commutative68.3%
associate-+r+68.3%
+-commutative68.3%
sub-neg68.3%
+-commutative68.3%
associate-+r+68.3%
sub-neg68.3%
*-commutative68.3%
+-commutative68.3%
unsub-neg68.3%
associate--r-68.3%
distribute-rgt-out--73.3%
*-commutative73.3%
distribute-lft-out--76.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.2%
Taylor expanded in d4 around 0 76.0%
if -8.00000000000000007e78 < d1 < -8.5000000000000001e-29 or 1.2e-306 < d1 < 2.5499999999999999e50Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
*-commutative100.0%
+-commutative100.0%
unsub-neg100.0%
associate--r-100.0%
distribute-rgt-out--100.0%
*-commutative100.0%
distribute-lft-out--100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 72.2%
+-commutative72.2%
associate--r+72.2%
Simplified72.2%
Taylor expanded in d1 around 0 67.5%
if -8.5000000000000001e-29 < d1 < 1.2e-306Initial program 100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r+100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
associate-+r+100.0%
sub-neg100.0%
*-commutative100.0%
+-commutative100.0%
unsub-neg100.0%
associate--r-100.0%
distribute-rgt-out--100.0%
*-commutative100.0%
distribute-lft-out--99.9%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d3 around 0 79.2%
Taylor expanded in d1 around 0 74.1%
Final simplification72.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d4 2.7e+15) (and (not (<= d4 6.2e+77)) (<= d4 9e+121))) (* d1 (- d2 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d4 <= 2.7e+15) || (!(d4 <= 6.2e+77) && (d4 <= 9e+121))) {
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.7d+15) .or. (.not. (d4 <= 6.2d+77)) .and. (d4 <= 9d+121)) 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.7e+15) || (!(d4 <= 6.2e+77) && (d4 <= 9e+121))) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d4 <= 2.7e+15) or (not (d4 <= 6.2e+77) and (d4 <= 9e+121)): tmp = d1 * (d2 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d4 <= 2.7e+15) || (!(d4 <= 6.2e+77) && (d4 <= 9e+121))) 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.7e+15) || (~((d4 <= 6.2e+77)) && (d4 <= 9e+121))) tmp = d1 * (d2 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d4, 2.7e+15], And[N[Not[LessEqual[d4, 6.2e+77]], $MachinePrecision], LessEqual[d4, 9e+121]]], 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.7 \cdot 10^{+15} \lor \neg \left(d4 \leq 6.2 \cdot 10^{+77}\right) \land d4 \leq 9 \cdot 10^{+121}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 2.7e15 or 6.19999999999999997e77 < d4 < 9.0000000000000007e121Initial program 86.9%
sub-neg86.9%
+-commutative86.9%
associate-+r+86.9%
+-commutative86.9%
sub-neg86.9%
+-commutative86.9%
associate-+r+86.9%
sub-neg86.9%
*-commutative86.9%
+-commutative86.9%
unsub-neg86.9%
associate--r-86.9%
distribute-rgt-out--89.4%
*-commutative89.4%
distribute-lft-out--90.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.6%
Taylor expanded in d4 around 0 60.9%
if 2.7e15 < d4 < 6.19999999999999997e77 or 9.0000000000000007e121 < d4 Initial program 89.4%
sub-neg89.4%
+-commutative89.4%
associate-+r+89.4%
+-commutative89.4%
sub-neg89.4%
+-commutative89.4%
associate-+r+89.4%
sub-neg89.4%
*-commutative89.4%
+-commutative89.4%
unsub-neg89.4%
associate--r-89.4%
distribute-rgt-out--89.4%
*-commutative89.4%
distribute-lft-out--91.1%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d3 around 0 81.4%
Taylor expanded in d1 around 0 71.2%
Final simplification63.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -8e+172) (not (<= d3 2.6e+187))) (* d1 (- d4 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -8e+172) || !(d3 <= 2.6e+187)) {
tmp = d1 * (d4 - d3);
} 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 ((d3 <= (-8d+172)) .or. (.not. (d3 <= 2.6d+187))) then
tmp = d1 * (d4 - d3)
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 ((d3 <= -8e+172) || !(d3 <= 2.6e+187)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -8e+172) or not (d3 <= 2.6e+187): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -8e+172) || !(d3 <= 2.6e+187)) tmp = Float64(d1 * Float64(d4 - d3)); 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 ((d3 <= -8e+172) || ~((d3 <= 2.6e+187))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -8e+172], N[Not[LessEqual[d3, 2.6e+187]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -8 \cdot 10^{+172} \lor \neg \left(d3 \leq 2.6 \cdot 10^{+187}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -8.0000000000000007e172 or 2.5999999999999999e187 < d3 Initial program 81.8%
sub-neg81.8%
+-commutative81.8%
associate-+r+81.8%
+-commutative81.8%
sub-neg81.8%
+-commutative81.8%
associate-+r+81.8%
sub-neg81.8%
*-commutative81.8%
+-commutative81.8%
unsub-neg81.8%
associate--r-81.8%
distribute-rgt-out--81.8%
*-commutative81.8%
distribute-lft-out--81.8%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d2 around 0 90.0%
+-commutative90.0%
associate--r+90.0%
Simplified90.0%
Taylor expanded in d1 around 0 84.5%
if -8.0000000000000007e172 < d3 < 2.5999999999999999e187Initial program 89.0%
sub-neg89.0%
+-commutative89.0%
associate-+r+89.0%
+-commutative89.0%
sub-neg89.0%
+-commutative89.0%
associate-+r+89.0%
sub-neg89.0%
*-commutative89.0%
+-commutative89.0%
unsub-neg89.0%
associate--r-89.0%
distribute-rgt-out--91.5%
*-commutative91.5%
distribute-lft-out--93.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.9%
Final simplification88.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -2.7e+93) (* d1 (- (- d4 d3) d1)) (if (<= d3 2.6e+187) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.7e+93) {
tmp = d1 * ((d4 - d3) - d1);
} else if (d3 <= 2.6e+187) {
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 <= (-2.7d+93)) then
tmp = d1 * ((d4 - d3) - d1)
else if (d3 <= 2.6d+187) 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 <= -2.7e+93) {
tmp = d1 * ((d4 - d3) - d1);
} else if (d3 <= 2.6e+187) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -2.7e+93: tmp = d1 * ((d4 - d3) - d1) elif d3 <= 2.6e+187: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -2.7e+93) tmp = Float64(d1 * Float64(Float64(d4 - d3) - d1)); elseif (d3 <= 2.6e+187) 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 <= -2.7e+93) tmp = d1 * ((d4 - d3) - d1); elseif (d3 <= 2.6e+187) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -2.7e+93], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.6e+187], 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 -2.7 \cdot 10^{+93}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\mathbf{elif}\;d3 \leq 2.6 \cdot 10^{+187}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -2.6999999999999999e93Initial program 74.4%
sub-neg74.4%
+-commutative74.4%
associate-+r+74.4%
+-commutative74.4%
sub-neg74.4%
+-commutative74.4%
associate-+r+74.4%
sub-neg74.4%
*-commutative74.4%
+-commutative74.4%
unsub-neg74.4%
associate--r-74.4%
distribute-rgt-out--74.4%
*-commutative74.4%
distribute-lft-out--76.5%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d2 around 0 82.3%
+-commutative82.3%
associate--r+82.3%
Simplified82.3%
if -2.6999999999999999e93 < d3 < 2.5999999999999999e187Initial program 90.7%
sub-neg90.7%
+-commutative90.7%
associate-+r+90.7%
+-commutative90.7%
sub-neg90.7%
+-commutative90.7%
associate-+r+90.7%
sub-neg90.7%
*-commutative90.7%
+-commutative90.7%
unsub-neg90.7%
associate--r-90.7%
distribute-rgt-out--93.4%
*-commutative93.4%
distribute-lft-out--94.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.6%
if 2.5999999999999999e187 < d3 Initial program 88.5%
sub-neg88.5%
+-commutative88.5%
associate-+r+88.5%
+-commutative88.5%
sub-neg88.5%
+-commutative88.5%
associate-+r+88.5%
sub-neg88.5%
*-commutative88.5%
+-commutative88.5%
unsub-neg88.5%
associate--r-88.5%
distribute-rgt-out--88.5%
*-commutative88.5%
distribute-lft-out--88.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 96.2%
+-commutative96.2%
associate--r+96.2%
Simplified96.2%
Taylor expanded in d1 around 0 92.3%
Final simplification90.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.56e+140) (not (<= d3 2e+165))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.56e+140) || !(d3 <= 2e+165)) {
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.56d+140)) .or. (.not. (d3 <= 2d+165))) 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.56e+140) || !(d3 <= 2e+165)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.56e+140) or not (d3 <= 2e+165): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.56e+140) || !(d3 <= 2e+165)) 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.56e+140) || ~((d3 <= 2e+165))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.56e+140], N[Not[LessEqual[d3, 2e+165]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.56 \cdot 10^{+140} \lor \neg \left(d3 \leq 2 \cdot 10^{+165}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.56000000000000002e140 or 1.9999999999999998e165 < d3 Initial program 79.1%
sub-neg79.1%
+-commutative79.1%
associate-+r+79.1%
+-commutative79.1%
sub-neg79.1%
+-commutative79.1%
associate-+r+79.1%
sub-neg79.1%
*-commutative79.1%
+-commutative79.1%
unsub-neg79.1%
associate--r-79.1%
distribute-rgt-out--80.5%
*-commutative80.5%
distribute-lft-out--80.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 73.9%
mul-1-neg73.9%
distribute-rgt-neg-out73.9%
Simplified73.9%
if -1.56000000000000002e140 < d3 < 1.9999999999999998e165Initial program 90.7%
sub-neg90.7%
+-commutative90.7%
associate-+r+90.7%
+-commutative90.7%
sub-neg90.7%
+-commutative90.7%
associate-+r+90.7%
sub-neg90.7%
*-commutative90.7%
+-commutative90.7%
unsub-neg90.7%
associate--r-90.7%
distribute-rgt-out--92.9%
*-commutative92.9%
distribute-lft-out--94.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.6%
Taylor expanded in d1 around 0 64.9%
Final simplification67.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -3e+109) (* d1 d2) (if (<= d2 -2.9e-266) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3e+109) {
tmp = d1 * d2;
} else if (d2 <= -2.9e-266) {
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 <= (-3d+109)) then
tmp = d1 * d2
else if (d2 <= (-2.9d-266)) 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 <= -3e+109) {
tmp = d1 * d2;
} else if (d2 <= -2.9e-266) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -3e+109: tmp = d1 * d2 elif d2 <= -2.9e-266: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -3e+109) tmp = Float64(d1 * d2); elseif (d2 <= -2.9e-266) 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 <= -3e+109) tmp = d1 * d2; elseif (d2 <= -2.9e-266) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -3e+109], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -2.9e-266], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -3 \cdot 10^{+109}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -2.9 \cdot 10^{-266}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -3.00000000000000015e109Initial program 80.8%
sub-neg80.8%
+-commutative80.8%
associate-+r+80.8%
+-commutative80.8%
sub-neg80.8%
+-commutative80.8%
associate-+r+80.8%
sub-neg80.8%
*-commutative80.8%
+-commutative80.8%
unsub-neg80.8%
associate--r-80.8%
distribute-rgt-out--87.2%
*-commutative87.2%
distribute-lft-out--89.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 69.6%
if -3.00000000000000015e109 < d2 < -2.89999999999999996e-266Initial program 91.6%
sub-neg91.6%
+-commutative91.6%
associate-+r+91.6%
+-commutative91.6%
sub-neg91.6%
+-commutative91.6%
associate-+r+91.6%
sub-neg91.6%
*-commutative91.6%
+-commutative91.6%
unsub-neg91.6%
associate--r-91.6%
distribute-rgt-out--91.5%
*-commutative91.5%
distribute-lft-out--92.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 43.5%
mul-1-neg43.5%
distribute-rgt-neg-out43.5%
Simplified43.5%
if -2.89999999999999996e-266 < d2 Initial program 87.3%
sub-neg87.3%
+-commutative87.3%
associate-+r+87.3%
+-commutative87.3%
sub-neg87.3%
+-commutative87.3%
associate-+r+87.3%
sub-neg87.3%
*-commutative87.3%
+-commutative87.3%
unsub-neg87.3%
associate--r-87.3%
distribute-rgt-out--88.9%
*-commutative88.9%
distribute-lft-out--89.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 30.0%
Final simplification41.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.4e-15) (* d1 (- d2 d1)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.4e-15) {
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.4d-15)) 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.4e-15) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.4e-15: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.4e-15) 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.4e-15) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.4e-15], 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.4 \cdot 10^{-15}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -2.39999999999999995e-15Initial program 85.5%
sub-neg85.5%
+-commutative85.5%
associate-+r+85.5%
+-commutative85.5%
sub-neg85.5%
+-commutative85.5%
associate-+r+85.5%
sub-neg85.5%
*-commutative85.5%
+-commutative85.5%
unsub-neg85.5%
associate--r-85.5%
distribute-rgt-out--89.5%
*-commutative89.5%
distribute-lft-out--90.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 80.8%
Taylor expanded in d4 around 0 63.2%
if -2.39999999999999995e-15 < d2 Initial program 88.3%
sub-neg88.3%
+-commutative88.3%
associate-+r+88.3%
+-commutative88.3%
sub-neg88.3%
+-commutative88.3%
associate-+r+88.3%
sub-neg88.3%
*-commutative88.3%
+-commutative88.3%
unsub-neg88.3%
associate--r-88.3%
distribute-rgt-out--89.4%
*-commutative89.4%
distribute-lft-out--90.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.3%
Taylor expanded in d2 around 0 58.0%
Final simplification59.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -7.5e-25) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -7.5e-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 (d2 <= (-7.5d-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 (d2 <= -7.5e-25) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -7.5e-25: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -7.5e-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 (d2 <= -7.5e-25) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -7.5e-25], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -7.5 \cdot 10^{-25}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -7.49999999999999989e-25Initial program 85.5%
sub-neg85.5%
+-commutative85.5%
associate-+r+85.5%
+-commutative85.5%
sub-neg85.5%
+-commutative85.5%
associate-+r+85.5%
sub-neg85.5%
*-commutative85.5%
+-commutative85.5%
unsub-neg85.5%
associate--r-85.5%
distribute-rgt-out--89.5%
*-commutative89.5%
distribute-lft-out--90.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 51.7%
if -7.49999999999999989e-25 < d2 Initial program 88.3%
sub-neg88.3%
+-commutative88.3%
associate-+r+88.3%
+-commutative88.3%
sub-neg88.3%
+-commutative88.3%
associate-+r+88.3%
sub-neg88.3%
*-commutative88.3%
+-commutative88.3%
unsub-neg88.3%
associate--r-88.3%
distribute-rgt-out--89.4%
*-commutative89.4%
distribute-lft-out--90.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 30.0%
Final simplification36.4%
(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%
sub-neg87.5%
+-commutative87.5%
associate-+r+87.5%
+-commutative87.5%
sub-neg87.5%
+-commutative87.5%
associate-+r+87.5%
sub-neg87.5%
*-commutative87.5%
+-commutative87.5%
unsub-neg87.5%
associate--r-87.5%
distribute-rgt-out--89.4%
*-commutative89.4%
distribute-lft-out--90.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.7%
Final simplification30.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 2023318
(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)))