
(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 13 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 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(d2 - d3) + Float64(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[(d2 - d3), $MachinePrecision] + N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\end{array}
Initial program 88.7%
associate--l+88.7%
distribute-lft-out--89.8%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d3 -6e+118)
t_0
(if (<= d3 3e-219)
(* d1 (- d4 d1))
(if (<= d3 5.4e-65)
(* d1 (+ d2 d4))
(if (<= d3 2e+35) (* d1 (- d2 d1)) t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d3 <= -6e+118) {
tmp = t_0;
} else if (d3 <= 3e-219) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 5.4e-65) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 2e+35) {
tmp = d1 * (d2 - 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) :: tmp
t_0 = d1 * (d2 - d3)
if (d3 <= (-6d+118)) then
tmp = t_0
else if (d3 <= 3d-219) then
tmp = d1 * (d4 - d1)
else if (d3 <= 5.4d-65) then
tmp = d1 * (d2 + d4)
else if (d3 <= 2d+35) then
tmp = d1 * (d2 - 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 tmp;
if (d3 <= -6e+118) {
tmp = t_0;
} else if (d3 <= 3e-219) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 5.4e-65) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 2e+35) {
tmp = d1 * (d2 - d1);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d3 <= -6e+118: tmp = t_0 elif d3 <= 3e-219: tmp = d1 * (d4 - d1) elif d3 <= 5.4e-65: tmp = d1 * (d2 + d4) elif d3 <= 2e+35: tmp = d1 * (d2 - d1) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d3 <= -6e+118) tmp = t_0; elseif (d3 <= 3e-219) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d3 <= 5.4e-65) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d3 <= 2e+35) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d3 <= -6e+118) tmp = t_0; elseif (d3 <= 3e-219) tmp = d1 * (d4 - d1); elseif (d3 <= 5.4e-65) tmp = d1 * (d2 + d4); elseif (d3 <= 2e+35) tmp = d1 * (d2 - 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]}, If[LessEqual[d3, -6e+118], t$95$0, If[LessEqual[d3, 3e-219], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 5.4e-65], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2e+35], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d3 \leq -6 \cdot 10^{+118}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 3 \cdot 10^{-219}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d3 \leq 5.4 \cdot 10^{-65}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d3 \leq 2 \cdot 10^{+35}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -6e118 or 1.9999999999999999e35 < d3 Initial program 85.4%
associate--l+85.4%
distribute-lft-out--87.4%
distribute-rgt-out--88.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.2%
+-commutative89.2%
associate--r+89.2%
Simplified89.2%
Taylor expanded in d1 around 0 85.4%
if -6e118 < d3 < 3.0000000000000001e-219Initial program 91.6%
Taylor expanded in d2 around 0 68.4%
distribute-lft-out--68.4%
Simplified68.4%
distribute-lft-out--74.8%
associate--r+74.8%
+-commutative74.8%
*-commutative74.8%
Applied egg-rr74.8%
Taylor expanded in d3 around 0 71.0%
if 3.0000000000000001e-219 < d3 < 5.3999999999999997e-65Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--90.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 90.6%
Taylor expanded in d4 around inf 82.4%
distribute-lft-out85.5%
*-commutative85.5%
+-commutative85.5%
Applied egg-rr85.5%
if 5.3999999999999997e-65 < d3 < 1.9999999999999999e35Initial program 92.3%
associate--l+92.3%
distribute-lft-out--92.3%
distribute-rgt-out--96.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 67.0%
+-commutative67.0%
associate--r+67.0%
Simplified67.0%
Taylor expanded in d3 around 0 63.4%
Final simplification77.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d3 -1.08e+61)
t_0
(if (<= d3 4.7e-65)
(* d1 (+ d2 d4))
(if (<= d3 6e+38) (* d1 (- d2 d1)) t_0)))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d3 <= -1.08e+61) {
tmp = t_0;
} else if (d3 <= 4.7e-65) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 6e+38) {
tmp = d1 * (d2 - 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) :: tmp
t_0 = d1 * (d2 - d3)
if (d3 <= (-1.08d+61)) then
tmp = t_0
else if (d3 <= 4.7d-65) then
tmp = d1 * (d2 + d4)
else if (d3 <= 6d+38) then
tmp = d1 * (d2 - 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 tmp;
if (d3 <= -1.08e+61) {
tmp = t_0;
} else if (d3 <= 4.7e-65) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 6e+38) {
tmp = d1 * (d2 - d1);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d3 <= -1.08e+61: tmp = t_0 elif d3 <= 4.7e-65: tmp = d1 * (d2 + d4) elif d3 <= 6e+38: tmp = d1 * (d2 - d1) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d3 <= -1.08e+61) tmp = t_0; elseif (d3 <= 4.7e-65) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d3 <= 6e+38) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d3 <= -1.08e+61) tmp = t_0; elseif (d3 <= 4.7e-65) tmp = d1 * (d2 + d4); elseif (d3 <= 6e+38) tmp = d1 * (d2 - 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]}, If[LessEqual[d3, -1.08e+61], t$95$0, If[LessEqual[d3, 4.7e-65], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 6e+38], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d3 \leq -1.08 \cdot 10^{+61}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 4.7 \cdot 10^{-65}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d3 \leq 6 \cdot 10^{+38}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -1.08e61 or 6.0000000000000002e38 < d3 Initial program 84.9%
associate--l+84.9%
distribute-lft-out--86.7%
distribute-rgt-out--87.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 88.5%
+-commutative88.5%
associate--r+88.5%
Simplified88.5%
Taylor expanded in d1 around 0 83.3%
if -1.08e61 < d3 < 4.7000000000000001e-65Initial program 91.5%
associate--l+91.5%
distribute-lft-out--92.3%
distribute-rgt-out--94.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 94.9%
Taylor expanded in d4 around inf 73.0%
distribute-lft-out74.7%
*-commutative74.7%
+-commutative74.7%
Applied egg-rr74.7%
if 4.7000000000000001e-65 < d3 < 6.0000000000000002e38Initial program 92.3%
associate--l+92.3%
distribute-lft-out--92.3%
distribute-rgt-out--96.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 67.0%
+-commutative67.0%
associate--r+67.0%
Simplified67.0%
Taylor expanded in d3 around 0 63.4%
Final simplification77.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 3.7e-147)
t_0
(if (<= d4 1.8e-116) (* d1 (- d1)) (if (<= d4 6.4e+162) t_0 (* d1 d4))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 3.7e-147) {
tmp = t_0;
} else if (d4 <= 1.8e-116) {
tmp = d1 * -d1;
} else if (d4 <= 6.4e+162) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 3.7d-147) then
tmp = t_0
else if (d4 <= 1.8d-116) then
tmp = d1 * -d1
else if (d4 <= 6.4d+162) then
tmp = t_0
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 3.7e-147) {
tmp = t_0;
} else if (d4 <= 1.8e-116) {
tmp = d1 * -d1;
} else if (d4 <= 6.4e+162) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 3.7e-147: tmp = t_0 elif d4 <= 1.8e-116: tmp = d1 * -d1 elif d4 <= 6.4e+162: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 3.7e-147) tmp = t_0; elseif (d4 <= 1.8e-116) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 6.4e+162) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 3.7e-147) tmp = t_0; elseif (d4 <= 1.8e-116) tmp = d1 * -d1; elseif (d4 <= 6.4e+162) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 3.7e-147], t$95$0, If[LessEqual[d4, 1.8e-116], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 6.4e+162], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 3.7 \cdot 10^{-147}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.8 \cdot 10^{-116}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 6.4 \cdot 10^{+162}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 3.7000000000000002e-147 or 1.79999999999999988e-116 < d4 < 6.4000000000000002e162Initial program 90.6%
associate--l+90.6%
distribute-lft-out--92.0%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.7%
+-commutative82.7%
associate--r+82.7%
Simplified82.7%
Taylor expanded in d1 around 0 64.0%
if 3.7000000000000002e-147 < d4 < 1.79999999999999988e-116Initial program 100.0%
Taylor expanded in d2 around 0 84.2%
distribute-lft-out--84.2%
Simplified84.2%
distribute-lft-out--84.2%
associate--r+84.2%
+-commutative84.2%
*-commutative84.2%
Applied egg-rr84.2%
Taylor expanded in d1 around inf 84.2%
neg-mul-184.2%
Simplified84.2%
if 6.4000000000000002e162 < d4 Initial program 75.0%
associate--l+75.0%
distribute-lft-out--75.0%
distribute-rgt-out--86.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 88.9%
Final simplification68.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 2.7e-95)
t_0
(if (<= d4 1.5e-42) (* d1 (- d3)) (if (<= d4 2.15e+36) t_0 (* d1 d4))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 2.7e-95) {
tmp = t_0;
} else if (d4 <= 1.5e-42) {
tmp = d1 * -d3;
} else if (d4 <= 2.15e+36) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d1)
if (d4 <= 2.7d-95) then
tmp = t_0
else if (d4 <= 1.5d-42) then
tmp = d1 * -d3
else if (d4 <= 2.15d+36) then
tmp = t_0
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 2.7e-95) {
tmp = t_0;
} else if (d4 <= 1.5e-42) {
tmp = d1 * -d3;
} else if (d4 <= 2.15e+36) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= 2.7e-95: tmp = t_0 elif d4 <= 1.5e-42: tmp = d1 * -d3 elif d4 <= 2.15e+36: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= 2.7e-95) tmp = t_0; elseif (d4 <= 1.5e-42) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 2.15e+36) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d4 <= 2.7e-95) tmp = t_0; elseif (d4 <= 1.5e-42) tmp = d1 * -d3; elseif (d4 <= 2.15e+36) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 2.7e-95], t$95$0, If[LessEqual[d4, 1.5e-42], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 2.15e+36], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq 2.7 \cdot 10^{-95}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.5 \cdot 10^{-42}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 2.15 \cdot 10^{+36}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.7e-95 or 1.50000000000000014e-42 < d4 < 2.15000000000000002e36Initial program 90.6%
associate--l+90.6%
distribute-lft-out--91.7%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.3%
+-commutative86.3%
associate--r+86.3%
Simplified86.3%
Taylor expanded in d3 around 0 61.4%
if 2.7e-95 < d4 < 1.50000000000000014e-42Initial program 87.5%
associate--l+87.5%
distribute-lft-out--100.0%
distribute-rgt-out--99.8%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in d3 around inf 75.9%
associate-*r*75.9%
neg-mul-175.9%
Simplified75.9%
if 2.15000000000000002e36 < d4 Initial program 83.6%
associate--l+83.6%
distribute-lft-out--83.6%
distribute-rgt-out--89.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 64.3%
Final simplification62.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -2.1e+119) (* d1 (- d2 d3)) (if (<= d3 2.1e+40) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.1e+119) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 2.1e+40) {
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.1d+119)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 2.1d+40) 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.1e+119) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 2.1e+40) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -2.1e+119: tmp = d1 * (d2 - d3) elif d3 <= 2.1e+40: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -2.1e+119) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 2.1e+40) 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.1e+119) tmp = d1 * (d2 - d3); elseif (d3 <= 2.1e+40) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -2.1e+119], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.1e+40], 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.1 \cdot 10^{+119}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 2.1 \cdot 10^{+40}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -2.09999999999999983e119Initial program 86.0%
associate--l+86.0%
distribute-lft-out--88.0%
distribute-rgt-out--88.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 93.0%
+-commutative93.0%
associate--r+93.0%
Simplified93.0%
Taylor expanded in d1 around 0 87.0%
if -2.09999999999999983e119 < d3 < 2.1000000000000001e40Initial program 90.8%
associate--l+90.8%
distribute-lft-out--91.5%
distribute-rgt-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.0%
if 2.1000000000000001e40 < d3 Initial program 84.9%
Taylor expanded in d2 around 0 73.8%
distribute-lft-out--79.4%
Simplified79.4%
distribute-lft-out--85.1%
associate--r+85.1%
+-commutative85.1%
*-commutative85.1%
Applied egg-rr85.1%
Taylor expanded in d1 around 0 81.4%
Final simplification91.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 5.5e-148) (* d1 (- d2 d3)) (if (<= d4 1.1e-97) (* d1 (- d2 d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5.5e-148) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.1e-97) {
tmp = d1 * (d2 - 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 (d4 <= 5.5d-148) then
tmp = d1 * (d2 - d3)
else if (d4 <= 1.1d-97) then
tmp = d1 * (d2 - 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 (d4 <= 5.5e-148) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.1e-97) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 5.5e-148: tmp = d1 * (d2 - d3) elif d4 <= 1.1e-97: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 5.5e-148) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 1.1e-97) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 5.5e-148) tmp = d1 * (d2 - d3); elseif (d4 <= 1.1e-97) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 5.5e-148], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.1e-97], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 5.5 \cdot 10^{-148}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 1.1 \cdot 10^{-97}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 5.5000000000000003e-148Initial program 89.2%
associate--l+89.2%
distribute-lft-out--90.5%
distribute-rgt-out--91.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.4%
+-commutative85.4%
associate--r+85.4%
Simplified85.4%
Taylor expanded in d1 around 0 64.6%
if 5.5000000000000003e-148 < d4 < 1.0999999999999999e-97Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
if 1.0999999999999999e-97 < d4 Initial program 86.8%
Taylor expanded in d2 around 0 77.5%
distribute-lft-out--80.8%
Simplified80.8%
distribute-lft-out--87.4%
associate--r+87.4%
+-commutative87.4%
*-commutative87.4%
Applied egg-rr87.4%
Taylor expanded in d1 around 0 78.0%
Final simplification70.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.12e-231) (* d1 d2) (if (<= d4 3.2e+116) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.12e-231) {
tmp = d1 * d2;
} else if (d4 <= 3.2e+116) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 1.12d-231) then
tmp = d1 * d2
else if (d4 <= 3.2d+116) then
tmp = d1 * -d3
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.12e-231) {
tmp = d1 * d2;
} else if (d4 <= 3.2e+116) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.12e-231: tmp = d1 * d2 elif d4 <= 3.2e+116: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.12e-231) tmp = Float64(d1 * d2); elseif (d4 <= 3.2e+116) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.12e-231) tmp = d1 * d2; elseif (d4 <= 3.2e+116) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.12e-231], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 3.2e+116], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.12 \cdot 10^{-231}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 3.2 \cdot 10^{+116}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.11999999999999997e-231Initial program 88.3%
associate--l+88.3%
distribute-lft-out--89.7%
distribute-rgt-out--90.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 34.6%
if 1.11999999999999997e-231 < d4 < 3.2e116Initial program 95.4%
associate--l+95.4%
distribute-lft-out--96.9%
distribute-rgt-out--96.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 42.6%
associate-*r*42.6%
neg-mul-142.6%
Simplified42.6%
if 3.2e116 < d4 Initial program 80.4%
associate--l+80.4%
distribute-lft-out--80.4%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 79.5%
Final simplification44.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.3e-202) (* d1 d2) (if (<= d4 2.15e+33) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.3e-202) {
tmp = d1 * d2;
} else if (d4 <= 2.15e+33) {
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 <= 3.3d-202) then
tmp = d1 * d2
else if (d4 <= 2.15d+33) 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 <= 3.3e-202) {
tmp = d1 * d2;
} else if (d4 <= 2.15e+33) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.3e-202: tmp = d1 * d2 elif d4 <= 2.15e+33: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.3e-202) tmp = Float64(d1 * d2); elseif (d4 <= 2.15e+33) 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 <= 3.3e-202) tmp = d1 * d2; elseif (d4 <= 2.15e+33) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.3e-202], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 2.15e+33], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.3 \cdot 10^{-202}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 2.15 \cdot 10^{+33}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 3.29999999999999989e-202Initial program 88.7%
associate--l+88.7%
distribute-lft-out--90.0%
distribute-rgt-out--90.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.5%
if 3.29999999999999989e-202 < d4 < 2.15000000000000014e33Initial program 97.4%
Taylor expanded in d2 around 0 79.4%
distribute-lft-out--79.4%
Simplified79.4%
distribute-lft-out--79.4%
associate--r+79.4%
+-commutative79.4%
*-commutative79.4%
Applied egg-rr79.4%
Taylor expanded in d1 around inf 47.9%
neg-mul-147.9%
Simplified47.9%
if 2.15000000000000014e33 < d4 Initial program 83.6%
associate--l+83.6%
distribute-lft-out--83.6%
distribute-rgt-out--89.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 64.3%
Final simplification44.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 6200000000000.0) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d1) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6200000000000.0) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 6200000000000.0d0) then
tmp = d1 * ((d2 - d3) - d1)
else
tmp = d1 * ((d4 - d1) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6200000000000.0) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 6200000000000.0: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 6200000000000.0) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(d4 - d1) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 6200000000000.0) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 6200000000000.0], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 6200000000000:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 6.2e12Initial program 90.1%
associate--l+90.1%
distribute-lft-out--91.7%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.4%
+-commutative86.4%
associate--r+86.4%
Simplified86.4%
if 6.2e12 < d4 Initial program 85.1%
associate--l+85.1%
distribute-lft-out--85.1%
distribute-rgt-out--90.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 90.0%
associate--r+90.0%
Simplified90.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.15e+36) (* d1 (- (- d2 d3) d1)) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.15e+36) {
tmp = d1 * ((d2 - d3) - 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 (d4 <= 2.15d+36) then
tmp = d1 * ((d2 - d3) - 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 (d4 <= 2.15e+36) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.15e+36: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.15e+36) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.15e+36) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.15e+36], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.15 \cdot 10^{+36}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 2.15000000000000002e36Initial program 90.5%
associate--l+90.5%
distribute-lft-out--92.1%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.4%
+-commutative86.4%
associate--r+86.4%
Simplified86.4%
if 2.15000000000000002e36 < d4 Initial program 83.6%
Taylor expanded in d2 around 0 78.6%
distribute-lft-out--83.0%
Simplified83.0%
distribute-lft-out--92.0%
associate--r+92.0%
+-commutative92.0%
*-commutative92.0%
Applied egg-rr92.0%
Taylor expanded in d1 around 0 88.9%
Final simplification87.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 7500000000000.0) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 7500000000000.0) {
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 <= 7500000000000.0d0) 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 <= 7500000000000.0) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 7500000000000.0: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 7500000000000.0) 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 <= 7500000000000.0) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 7500000000000.0], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 7500000000000:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 7.5e12Initial program 90.1%
associate--l+90.1%
distribute-lft-out--91.7%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.5%
if 7.5e12 < d4 Initial program 85.1%
associate--l+85.1%
distribute-lft-out--85.1%
distribute-rgt-out--90.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 59.0%
(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 88.7%
associate--l+88.7%
distribute-lft-out--89.8%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 28.3%
(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 2024085
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))