
(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 85.5%
associate--l+85.5%
distribute-lft-out--85.5%
distribute-rgt-out--88.6%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (- (* d1 (+ d1 d3)))))
(if (<= d4 -1.45e-104)
t_0
(if (<= d4 -4.5e-267)
t_1
(if (<= d4 5e-190)
t_0
(if (<= d4 2.7e-75)
t_1
(if (<= d4 2.4e-21)
(* d1 (- d2 d3))
(if (<= d4 3.05e+99) t_1 (* d1 (+ d2 d4))))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = -(d1 * (d1 + d3));
double tmp;
if (d4 <= -1.45e-104) {
tmp = t_0;
} else if (d4 <= -4.5e-267) {
tmp = t_1;
} else if (d4 <= 5e-190) {
tmp = t_0;
} else if (d4 <= 2.7e-75) {
tmp = t_1;
} else if (d4 <= 2.4e-21) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3.05e+99) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = -(d1 * (d1 + d3))
if (d4 <= (-1.45d-104)) then
tmp = t_0
else if (d4 <= (-4.5d-267)) then
tmp = t_1
else if (d4 <= 5d-190) then
tmp = t_0
else if (d4 <= 2.7d-75) then
tmp = t_1
else if (d4 <= 2.4d-21) then
tmp = d1 * (d2 - d3)
else if (d4 <= 3.05d+99) then
tmp = t_1
else
tmp = d1 * (d2 + 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 t_1 = -(d1 * (d1 + d3));
double tmp;
if (d4 <= -1.45e-104) {
tmp = t_0;
} else if (d4 <= -4.5e-267) {
tmp = t_1;
} else if (d4 <= 5e-190) {
tmp = t_0;
} else if (d4 <= 2.7e-75) {
tmp = t_1;
} else if (d4 <= 2.4e-21) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3.05e+99) {
tmp = t_1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = -(d1 * (d1 + d3)) tmp = 0 if d4 <= -1.45e-104: tmp = t_0 elif d4 <= -4.5e-267: tmp = t_1 elif d4 <= 5e-190: tmp = t_0 elif d4 <= 2.7e-75: tmp = t_1 elif d4 <= 2.4e-21: tmp = d1 * (d2 - d3) elif d4 <= 3.05e+99: tmp = t_1 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(-Float64(d1 * Float64(d1 + d3))) tmp = 0.0 if (d4 <= -1.45e-104) tmp = t_0; elseif (d4 <= -4.5e-267) tmp = t_1; elseif (d4 <= 5e-190) tmp = t_0; elseif (d4 <= 2.7e-75) tmp = t_1; elseif (d4 <= 2.4e-21) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 3.05e+99) tmp = t_1; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = -(d1 * (d1 + d3)); tmp = 0.0; if (d4 <= -1.45e-104) tmp = t_0; elseif (d4 <= -4.5e-267) tmp = t_1; elseif (d4 <= 5e-190) tmp = t_0; elseif (d4 <= 2.7e-75) tmp = t_1; elseif (d4 <= 2.4e-21) tmp = d1 * (d2 - d3); elseif (d4 <= 3.05e+99) tmp = t_1; else tmp = d1 * (d2 + d4); 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[(d1 + d3), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[d4, -1.45e-104], t$95$0, If[LessEqual[d4, -4.5e-267], t$95$1, If[LessEqual[d4, 5e-190], t$95$0, If[LessEqual[d4, 2.7e-75], t$95$1, If[LessEqual[d4, 2.4e-21], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 3.05e+99], t$95$1, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := -d1 \cdot \left(d1 + d3\right)\\
\mathbf{if}\;d4 \leq -1.45 \cdot 10^{-104}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq -4.5 \cdot 10^{-267}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 5 \cdot 10^{-190}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 2.7 \cdot 10^{-75}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 2.4 \cdot 10^{-21}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 3.05 \cdot 10^{+99}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -1.4500000000000001e-104 or -4.4999999999999999e-267 < d4 < 5.00000000000000034e-190Initial program 85.2%
associate--l+85.2%
distribute-lft-out--85.2%
distribute-rgt-out--87.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 85.4%
Taylor expanded in d4 around 0 63.0%
if -1.4500000000000001e-104 < d4 < -4.4999999999999999e-267 or 5.00000000000000034e-190 < d4 < 2.6999999999999998e-75 or 2.3999999999999999e-21 < d4 < 3.04999999999999986e99Initial program 88.4%
associate--l+88.4%
distribute-lft-out--88.4%
distribute-rgt-out--89.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 99.5%
Taylor expanded in d2 around 0 77.3%
mul-1-neg77.3%
distribute-rgt-neg-in77.3%
Simplified77.3%
if 2.6999999999999998e-75 < d4 < 2.3999999999999999e-21Initial program 92.3%
associate--l+92.3%
distribute-lft-out--92.3%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 93.0%
Taylor expanded in d1 around 0 63.8%
if 3.04999999999999986e99 < d4 Initial program 80.6%
associate--l+80.6%
distribute-lft-out--80.7%
distribute-rgt-out--87.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.5%
Taylor expanded in d1 around 0 84.2%
Final simplification72.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (or (<= d3 -4.8e+145)
(not (or (<= d3 3.2e+58) (and (not (<= d3 3e+85)) (<= d3 7e+119)))))
(* d1 (- d4 d3))
(* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -4.8e+145) || !((d3 <= 3.2e+58) || (!(d3 <= 3e+85) && (d3 <= 7e+119)))) {
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 <= (-4.8d+145)) .or. (.not. (d3 <= 3.2d+58) .or. (.not. (d3 <= 3d+85)) .and. (d3 <= 7d+119))) 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 <= -4.8e+145) || !((d3 <= 3.2e+58) || (!(d3 <= 3e+85) && (d3 <= 7e+119)))) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -4.8e+145) or not ((d3 <= 3.2e+58) or (not (d3 <= 3e+85) and (d3 <= 7e+119))): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -4.8e+145) || !((d3 <= 3.2e+58) || (!(d3 <= 3e+85) && (d3 <= 7e+119)))) 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 <= -4.8e+145) || ~(((d3 <= 3.2e+58) || (~((d3 <= 3e+85)) && (d3 <= 7e+119))))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -4.8e+145], N[Not[Or[LessEqual[d3, 3.2e+58], And[N[Not[LessEqual[d3, 3e+85]], $MachinePrecision], LessEqual[d3, 7e+119]]]], $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 -4.8 \cdot 10^{+145} \lor \neg \left(d3 \leq 3.2 \cdot 10^{+58} \lor \neg \left(d3 \leq 3 \cdot 10^{+85}\right) \land d3 \leq 7 \cdot 10^{+119}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -4.79999999999999984e145 or 3.20000000000000015e58 < d3 < 3e85 or 7.0000000000000001e119 < d3 Initial program 81.7%
associate--l+81.7%
distribute-lft-out--81.7%
distribute-rgt-out--84.5%
distribute-lft-out100.0%
Simplified100.0%
distribute-lft-in84.5%
distribute-lft-out--81.7%
+-commutative81.7%
distribute-lft-out--81.7%
associate-+r-81.7%
distribute-lft-out--84.5%
Applied egg-rr84.5%
distribute-lft-out84.5%
fma-neg88.7%
associate-+l-88.7%
distribute-rgt-neg-in88.7%
Applied egg-rr88.7%
Taylor expanded in d1 around 0 90.1%
+-commutative90.1%
mul-1-neg90.1%
unsub-neg90.1%
Simplified90.1%
Taylor expanded in d2 around 0 79.5%
if -4.79999999999999984e145 < d3 < 3.20000000000000015e58 or 3e85 < d3 < 7.0000000000000001e119Initial program 87.0%
associate--l+87.0%
distribute-lft-out--87.0%
distribute-rgt-out--90.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 92.9%
Final simplification89.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))))
(if (<= d4 -1.3e-103)
(* d1 d2)
(if (<= d4 1.9e-75)
t_0
(if (<= d4 3.3e-10) (* d1 d2) (if (<= d4 6.2e+102) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double tmp;
if (d4 <= -1.3e-103) {
tmp = d1 * d2;
} else if (d4 <= 1.9e-75) {
tmp = t_0;
} else if (d4 <= 3.3e-10) {
tmp = d1 * d2;
} else if (d4 <= 6.2e+102) {
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 * -d1
if (d4 <= (-1.3d-103)) then
tmp = d1 * d2
else if (d4 <= 1.9d-75) then
tmp = t_0
else if (d4 <= 3.3d-10) then
tmp = d1 * d2
else if (d4 <= 6.2d+102) 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 * -d1;
double tmp;
if (d4 <= -1.3e-103) {
tmp = d1 * d2;
} else if (d4 <= 1.9e-75) {
tmp = t_0;
} else if (d4 <= 3.3e-10) {
tmp = d1 * d2;
} else if (d4 <= 6.2e+102) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 tmp = 0 if d4 <= -1.3e-103: tmp = d1 * d2 elif d4 <= 1.9e-75: tmp = t_0 elif d4 <= 3.3e-10: tmp = d1 * d2 elif d4 <= 6.2e+102: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) tmp = 0.0 if (d4 <= -1.3e-103) tmp = Float64(d1 * d2); elseif (d4 <= 1.9e-75) tmp = t_0; elseif (d4 <= 3.3e-10) tmp = Float64(d1 * d2); elseif (d4 <= 6.2e+102) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; tmp = 0.0; if (d4 <= -1.3e-103) tmp = d1 * d2; elseif (d4 <= 1.9e-75) tmp = t_0; elseif (d4 <= 3.3e-10) tmp = d1 * d2; elseif (d4 <= 6.2e+102) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, If[LessEqual[d4, -1.3e-103], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.9e-75], t$95$0, If[LessEqual[d4, 3.3e-10], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 6.2e+102], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
\mathbf{if}\;d4 \leq -1.3 \cdot 10^{-103}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.9 \cdot 10^{-75}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 3.3 \cdot 10^{-10}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 6.2 \cdot 10^{+102}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -1.29999999999999998e-103 or 1.89999999999999997e-75 < d4 < 3.3e-10Initial program 84.3%
associate--l+84.3%
distribute-lft-out--84.3%
distribute-rgt-out--87.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around inf 29.3%
if -1.29999999999999998e-103 < d4 < 1.89999999999999997e-75 or 3.3e-10 < d4 < 6.19999999999999973e102Initial program 88.7%
associate--l+88.7%
distribute-lft-out--88.7%
distribute-rgt-out--89.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 46.1%
neg-mul-146.1%
unpow246.1%
distribute-rgt-neg-in46.1%
Simplified46.1%
if 6.19999999999999973e102 < d4 Initial program 82.1%
associate--l+82.1%
distribute-lft-out--82.1%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 74.0%
Final simplification45.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -49000000000000.0) (not (<= d1 4.4e+113))) (* d1 (- (+ d2 d4) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -49000000000000.0) || !(d1 <= 4.4e+113)) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + 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 ((d1 <= (-49000000000000.0d0)) .or. (.not. (d1 <= 4.4d+113))) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -49000000000000.0) || !(d1 <= 4.4e+113)) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -49000000000000.0) or not (d1 <= 4.4e+113): tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -49000000000000.0) || !(d1 <= 4.4e+113)) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -49000000000000.0) || ~((d1 <= 4.4e+113))) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -49000000000000.0], N[Not[LessEqual[d1, 4.4e+113]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -49000000000000 \lor \neg \left(d1 \leq 4.4 \cdot 10^{+113}\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -4.9e13 or 4.40000000000000021e113 < d1 Initial program 66.3%
associate--l+66.3%
distribute-lft-out--66.3%
distribute-rgt-out--73.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.2%
if -4.9e13 < d1 < 4.40000000000000021e113Initial program 99.9%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 93.6%
Final simplification93.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -4.4e+38) (not (<= d3 3e-45))) (* d1 (- (- d4 d1) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -4.4e+38) || !(d3 <= 3e-45)) {
tmp = d1 * ((d4 - d1) - 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 <= (-4.4d+38)) .or. (.not. (d3 <= 3d-45))) then
tmp = d1 * ((d4 - d1) - 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 <= -4.4e+38) || !(d3 <= 3e-45)) {
tmp = d1 * ((d4 - d1) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -4.4e+38) or not (d3 <= 3e-45): tmp = d1 * ((d4 - d1) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -4.4e+38) || !(d3 <= 3e-45)) tmp = Float64(d1 * Float64(Float64(d4 - d1) - 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 <= -4.4e+38) || ~((d3 <= 3e-45))) tmp = d1 * ((d4 - d1) - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -4.4e+38], N[Not[LessEqual[d3, 3e-45]], $MachinePrecision]], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -4.4 \cdot 10^{+38} \lor \neg \left(d3 \leq 3 \cdot 10^{-45}\right):\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -4.40000000000000013e38 or 3.00000000000000011e-45 < d3 Initial program 82.3%
associate--l+82.3%
distribute-lft-out--82.3%
distribute-rgt-out--85.4%
distribute-lft-out100.0%
Simplified100.0%
distribute-lft-in85.4%
distribute-lft-out--82.3%
+-commutative82.3%
distribute-lft-out--82.3%
associate-+r-82.3%
distribute-lft-out--85.3%
Applied egg-rr85.3%
Taylor expanded in d2 around 0 74.8%
distribute-lft-out--87.1%
Simplified87.1%
if -4.40000000000000013e38 < d3 < 3.00000000000000011e-45Initial program 88.8%
associate--l+88.9%
distribute-lft-out--88.9%
distribute-rgt-out--92.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.4%
Final simplification92.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -1.6e+150) (not (<= d1 3.6e+121))) (* d1 (- d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1.6e+150) || !(d1 <= 3.6e+121)) {
tmp = d1 * -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 ((d1 <= (-1.6d+150)) .or. (.not. (d1 <= 3.6d+121))) then
tmp = d1 * -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 ((d1 <= -1.6e+150) || !(d1 <= 3.6e+121)) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -1.6e+150) or not (d1 <= 3.6e+121): tmp = d1 * -d1 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -1.6e+150) || !(d1 <= 3.6e+121)) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -1.6e+150) || ~((d1 <= 3.6e+121))) tmp = d1 * -d1; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -1.6e+150], N[Not[LessEqual[d1, 3.6e+121]], $MachinePrecision]], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -1.6 \cdot 10^{+150} \lor \neg \left(d1 \leq 3.6 \cdot 10^{+121}\right):\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d1 < -1.60000000000000008e150 or 3.59999999999999981e121 < d1 Initial program 54.3%
associate--l+54.3%
distribute-lft-out--54.3%
distribute-rgt-out--64.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 83.1%
neg-mul-183.1%
unpow283.1%
distribute-rgt-neg-in83.1%
Simplified83.1%
if -1.60000000000000008e150 < d1 < 3.59999999999999981e121Initial program 99.9%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 73.3%
Taylor expanded in d1 around 0 63.5%
Final simplification69.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 8.8e+100) (* d1 (- d2 (+ d1 d3))) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.8e+100) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + 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 <= 8.8d+100) then
tmp = d1 * (d2 - (d1 + d3))
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.8e+100) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 8.8e+100: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 8.8e+100) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 8.8e+100) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 8.8e+100], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 8.8 \cdot 10^{+100}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 8.8000000000000003e100Initial program 86.9%
associate--l+86.9%
distribute-lft-out--86.9%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 87.2%
if 8.8000000000000003e100 < d4 Initial program 80.6%
associate--l+80.6%
distribute-lft-out--80.7%
distribute-rgt-out--87.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.4%
Final simplification88.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.05e+87) (* d1 (+ d2 d4)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.05e+87) {
tmp = d1 * (d2 + d4);
} 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 <= (-1.05d+87)) then
tmp = d1 * (d2 + d4)
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 <= -1.05e+87) {
tmp = d1 * (d2 + d4);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.05e+87: tmp = d1 * (d2 + d4) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.05e+87) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.05e+87) tmp = d1 * (d2 + d4); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.05e+87], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.05 \cdot 10^{+87}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.05e87Initial program 76.2%
associate--l+76.2%
distribute-lft-out--76.2%
distribute-rgt-out--76.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 93.2%
Taylor expanded in d1 around 0 76.6%
if -1.05e87 < d2 Initial program 87.3%
associate--l+87.3%
distribute-lft-out--87.4%
distribute-rgt-out--91.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 78.1%
Taylor expanded in d2 around 0 62.5%
Final simplification64.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.5e+102) (* d1 (- d2 d1)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.5e+102) {
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 (d4 <= 3.5d+102) 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 (d4 <= 3.5e+102) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.5e+102: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.5e+102) 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 (d4 <= 3.5e+102) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.5e+102], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.5 \cdot 10^{+102}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < 3.50000000000000011e102Initial program 86.5%
associate--l+86.5%
distribute-lft-out--86.5%
distribute-rgt-out--88.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 76.7%
Taylor expanded in d4 around 0 64.0%
if 3.50000000000000011e102 < d4 Initial program 82.1%
associate--l+82.1%
distribute-lft-out--82.1%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.4%
Taylor expanded in d2 around 0 84.5%
Final simplification68.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 7.6e+65) (* d1 (- d2 d1)) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 7.6e+65) {
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 <= 7.6d+65) 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 <= 7.6e+65) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 7.6e+65: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 7.6e+65) 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 <= 7.6e+65) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 7.6e+65], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 7.6 \cdot 10^{+65}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 7.60000000000000022e65Initial program 87.2%
associate--l+87.2%
distribute-lft-out--87.2%
distribute-rgt-out--88.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 76.7%
Taylor expanded in d4 around 0 63.8%
if 7.60000000000000022e65 < d4 Initial program 79.9%
associate--l+79.9%
distribute-lft-out--80.0%
distribute-rgt-out--88.3%
distribute-lft-out100.0%
Simplified100.0%
distribute-lft-in88.3%
distribute-lft-out--80.0%
+-commutative80.0%
distribute-lft-out--79.9%
associate-+r-79.9%
distribute-lft-out--88.3%
Applied egg-rr88.3%
distribute-lft-out94.9%
fma-neg95.0%
associate-+l-95.0%
distribute-rgt-neg-in95.0%
Applied egg-rr95.0%
Taylor expanded in d1 around 0 88.5%
+-commutative88.5%
mul-1-neg88.5%
unsub-neg88.5%
Simplified88.5%
Taylor expanded in d2 around 0 76.5%
Final simplification66.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 9.6e+104) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 9.6e+104) {
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 <= 9.6d+104) 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 <= 9.6e+104) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 9.6e+104: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 9.6e+104) 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 <= 9.6e+104) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 9.6e+104], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 9.6 \cdot 10^{+104}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 9.6e104Initial program 86.5%
associate--l+86.5%
distribute-lft-out--86.5%
distribute-rgt-out--88.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.3%
if 9.6e104 < d4 Initial program 82.1%
associate--l+82.1%
distribute-lft-out--82.1%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 74.0%
Final simplification40.6%
(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.5%
associate--l+85.5%
distribute-lft-out--85.5%
distribute-rgt-out--88.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 33.0%
Final simplification33.0%
(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 2023257
(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)))