
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- 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 90.2%
associate--l+90.2%
distribute-lft-out--91.4%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -3.1e-161)
(* d1 d2)
(if (<= d4 5.3e-16)
(* d1 (- d1))
(if (<= d4 85000000000.0)
(* d1 (- d3))
(if (<= d4 1.1e+33)
(* d1 d4)
(if (<= d4 3.5e+72) (* d1 d2) (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -3.1e-161) {
tmp = d1 * d2;
} else if (d4 <= 5.3e-16) {
tmp = d1 * -d1;
} else if (d4 <= 85000000000.0) {
tmp = d1 * -d3;
} else if (d4 <= 1.1e+33) {
tmp = d1 * d4;
} else if (d4 <= 3.5e+72) {
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 <= (-3.1d-161)) then
tmp = d1 * d2
else if (d4 <= 5.3d-16) then
tmp = d1 * -d1
else if (d4 <= 85000000000.0d0) then
tmp = d1 * -d3
else if (d4 <= 1.1d+33) then
tmp = d1 * d4
else if (d4 <= 3.5d+72) 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 <= -3.1e-161) {
tmp = d1 * d2;
} else if (d4 <= 5.3e-16) {
tmp = d1 * -d1;
} else if (d4 <= 85000000000.0) {
tmp = d1 * -d3;
} else if (d4 <= 1.1e+33) {
tmp = d1 * d4;
} else if (d4 <= 3.5e+72) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -3.1e-161: tmp = d1 * d2 elif d4 <= 5.3e-16: tmp = d1 * -d1 elif d4 <= 85000000000.0: tmp = d1 * -d3 elif d4 <= 1.1e+33: tmp = d1 * d4 elif d4 <= 3.5e+72: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -3.1e-161) tmp = Float64(d1 * d2); elseif (d4 <= 5.3e-16) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 85000000000.0) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 1.1e+33) tmp = Float64(d1 * d4); elseif (d4 <= 3.5e+72) 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 <= -3.1e-161) tmp = d1 * d2; elseif (d4 <= 5.3e-16) tmp = d1 * -d1; elseif (d4 <= 85000000000.0) tmp = d1 * -d3; elseif (d4 <= 1.1e+33) tmp = d1 * d4; elseif (d4 <= 3.5e+72) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -3.1e-161], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 5.3e-16], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 85000000000.0], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 1.1e+33], N[(d1 * d4), $MachinePrecision], If[LessEqual[d4, 3.5e+72], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -3.1 \cdot 10^{-161}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 5.3 \cdot 10^{-16}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 85000000000:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 1.1 \cdot 10^{+33}:\\
\;\;\;\;d1 \cdot d4\\
\mathbf{elif}\;d4 \leq 3.5 \cdot 10^{+72}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -3.0999999999999999e-161 or 1.09999999999999997e33 < d4 < 3.5000000000000001e72Initial program 92.2%
associate--l+92.2%
distribute-lft-out--92.2%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 26.9%
if -3.0999999999999999e-161 < d4 < 5.30000000000000033e-16Initial program 89.0%
associate--l+89.0%
distribute-lft-out--92.3%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 52.3%
unpow252.3%
mul-1-neg52.3%
distribute-rgt-neg-out52.3%
Simplified52.3%
if 5.30000000000000033e-16 < d4 < 8.5e10Initial program 90.0%
associate--l+90.0%
distribute-lft-out--90.0%
distribute-rgt-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 71.1%
associate-*r*71.1%
neg-mul-171.1%
Simplified71.1%
if 8.5e10 < d4 < 1.09999999999999997e33 or 3.5000000000000001e72 < d4 Initial program 89.2%
associate--l+89.2%
distribute-lft-out--89.2%
distribute-rgt-out--96.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 61.2%
Final simplification46.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -7.6e-175)
(* d1 (- d2 d3))
(if (<= d4 1.45e-10)
(* d1 (- d2 d1))
(if (or (<= d4 62000000000.0) (not (<= d4 6.2e+75)))
(* d1 (- d4 d3))
(* d1 (+ d2 d4))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -7.6e-175) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.45e-10) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 62000000000.0) || !(d4 <= 6.2e+75)) {
tmp = d1 * (d4 - 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 (d4 <= (-7.6d-175)) then
tmp = d1 * (d2 - d3)
else if (d4 <= 1.45d-10) then
tmp = d1 * (d2 - d1)
else if ((d4 <= 62000000000.0d0) .or. (.not. (d4 <= 6.2d+75))) then
tmp = d1 * (d4 - 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 (d4 <= -7.6e-175) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.45e-10) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 62000000000.0) || !(d4 <= 6.2e+75)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -7.6e-175: tmp = d1 * (d2 - d3) elif d4 <= 1.45e-10: tmp = d1 * (d2 - d1) elif (d4 <= 62000000000.0) or not (d4 <= 6.2e+75): tmp = d1 * (d4 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -7.6e-175) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 1.45e-10) tmp = Float64(d1 * Float64(d2 - d1)); elseif ((d4 <= 62000000000.0) || !(d4 <= 6.2e+75)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= -7.6e-175) tmp = d1 * (d2 - d3); elseif (d4 <= 1.45e-10) tmp = d1 * (d2 - d1); elseif ((d4 <= 62000000000.0) || ~((d4 <= 6.2e+75))) tmp = d1 * (d4 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -7.6e-175], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.45e-10], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d4, 62000000000.0], N[Not[LessEqual[d4, 6.2e+75]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -7.6 \cdot 10^{-175}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 1.45 \cdot 10^{-10}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 62000000000 \lor \neg \left(d4 \leq 6.2 \cdot 10^{+75}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -7.6e-175Initial program 90.6%
associate--l+90.6%
distribute-lft-out--91.7%
distribute-rgt-out--91.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.5%
Taylor expanded in d4 around 0 46.7%
if -7.6e-175 < d4 < 1.4499999999999999e-10Initial program 91.2%
associate--l+91.2%
distribute-lft-out--93.4%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.9%
Taylor expanded in d4 around 0 76.9%
if 1.4499999999999999e-10 < d4 < 6.2e10 or 6.2000000000000002e75 < d4 Initial program 89.6%
associate--l+89.6%
distribute-lft-out--89.6%
distribute-rgt-out--97.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.6%
Taylor expanded in d2 around 0 81.7%
if 6.2e10 < d4 < 6.2000000000000002e75Initial program 84.4%
associate--l+84.4%
distribute-lft-out--84.4%
distribute-rgt-out--84.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.6%
Taylor expanded in d1 around 0 64.6%
Final simplification67.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d1 (+ d2 d4))))
(if (<= d1 -8e+132)
t_0
(if (<= d1 4.5e-98)
t_1
(if (<= d1 7.8e-19) (* d1 (- d3)) (if (<= d1 1.15e+98) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d1 <= -8e+132) {
tmp = t_0;
} else if (d1 <= 4.5e-98) {
tmp = t_1;
} else if (d1 <= 7.8e-19) {
tmp = d1 * -d3;
} else if (d1 <= 1.15e+98) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * -d1
t_1 = d1 * (d2 + d4)
if (d1 <= (-8d+132)) then
tmp = t_0
else if (d1 <= 4.5d-98) then
tmp = t_1
else if (d1 <= 7.8d-19) then
tmp = d1 * -d3
else if (d1 <= 1.15d+98) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d1 <= -8e+132) {
tmp = t_0;
} else if (d1 <= 4.5e-98) {
tmp = t_1;
} else if (d1 <= 7.8e-19) {
tmp = d1 * -d3;
} else if (d1 <= 1.15e+98) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = d1 * (d2 + d4) tmp = 0 if d1 <= -8e+132: tmp = t_0 elif d1 <= 4.5e-98: tmp = t_1 elif d1 <= 7.8e-19: tmp = d1 * -d3 elif d1 <= 1.15e+98: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d1 <= -8e+132) tmp = t_0; elseif (d1 <= 4.5e-98) tmp = t_1; elseif (d1 <= 7.8e-19) tmp = Float64(d1 * Float64(-d3)); elseif (d1 <= 1.15e+98) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = d1 * (d2 + d4); tmp = 0.0; if (d1 <= -8e+132) tmp = t_0; elseif (d1 <= 4.5e-98) tmp = t_1; elseif (d1 <= 7.8e-19) tmp = d1 * -d3; elseif (d1 <= 1.15e+98) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -8e+132], t$95$0, If[LessEqual[d1, 4.5e-98], t$95$1, If[LessEqual[d1, 7.8e-19], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d1, 1.15e+98], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d1 \leq -8 \cdot 10^{+132}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d1 \leq 4.5 \cdot 10^{-98}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d1 \leq 7.8 \cdot 10^{-19}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d1 \leq 1.15 \cdot 10^{+98}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d1 < -7.99999999999999993e132 or 1.15000000000000007e98 < d1 Initial program 72.6%
associate--l+72.6%
distribute-lft-out--73.8%
distribute-rgt-out--79.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 87.0%
unpow287.0%
mul-1-neg87.0%
distribute-rgt-neg-out87.0%
Simplified87.0%
if -7.99999999999999993e132 < d1 < 4.49999999999999997e-98 or 7.7999999999999999e-19 < d1 < 1.15000000000000007e98Initial program 98.7%
associate--l+98.7%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 74.5%
Taylor expanded in d1 around 0 67.1%
if 4.49999999999999997e-98 < d1 < 7.7999999999999999e-19Initial program 100.0%
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 inf 65.7%
associate-*r*65.7%
neg-mul-165.7%
Simplified65.7%
Final simplification73.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d2 -1e+73)
t_0
(if (<= d2 -3.7e+26)
(* d1 (- d2 d1))
(if (<= d2 -1.15e-60) t_0 (* d1 (- d4 d1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d2 <= -1e+73) {
tmp = t_0;
} else if (d2 <= -3.7e+26) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -1.15e-60) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d2 <= (-1d+73)) then
tmp = t_0
else if (d2 <= (-3.7d+26)) then
tmp = d1 * (d2 - d1)
else if (d2 <= (-1.15d-60)) then
tmp = t_0
else
tmp = d1 * (d4 - d1)
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 (d2 <= -1e+73) {
tmp = t_0;
} else if (d2 <= -3.7e+26) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -1.15e-60) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d2 <= -1e+73: tmp = t_0 elif d2 <= -3.7e+26: tmp = d1 * (d2 - d1) elif d2 <= -1.15e-60: tmp = t_0 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d2 <= -1e+73) tmp = t_0; elseif (d2 <= -3.7e+26) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d2 <= -1.15e-60) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d2 <= -1e+73) tmp = t_0; elseif (d2 <= -3.7e+26) tmp = d1 * (d2 - d1); elseif (d2 <= -1.15e-60) tmp = t_0; else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -1e+73], t$95$0, If[LessEqual[d2, -3.7e+26], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -1.15e-60], t$95$0, N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d2 \leq -1 \cdot 10^{+73}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -3.7 \cdot 10^{+26}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -1.15 \cdot 10^{-60}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -9.99999999999999983e72 or -3.69999999999999988e26 < d2 < -1.1500000000000001e-60Initial program 91.0%
associate--l+91.0%
distribute-lft-out--92.8%
distribute-rgt-out--92.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 89.3%
Taylor expanded in d4 around 0 68.4%
if -9.99999999999999983e72 < d2 < -3.69999999999999988e26Initial program 84.4%
associate--l+84.4%
distribute-lft-out--84.4%
distribute-rgt-out--92.1%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 84.7%
Taylor expanded in d4 around 0 70.0%
if -1.1500000000000001e-60 < d2 Initial program 90.3%
associate--l+90.3%
distribute-lft-out--91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in d2 around 0 78.4%
unpow278.4%
associate--l+78.4%
distribute-lft-out--80.5%
associate-*r*80.5%
neg-mul-180.5%
fma-def84.8%
Simplified84.8%
Taylor expanded in d3 around 0 67.0%
Final simplification67.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -5.9e+84) (not (<= d3 8.5e+160))) (* d1 (- d4 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -5.9e+84) || !(d3 <= 8.5e+160)) {
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 <= (-5.9d+84)) .or. (.not. (d3 <= 8.5d+160))) 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 <= -5.9e+84) || !(d3 <= 8.5e+160)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -5.9e+84) or not (d3 <= 8.5e+160): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -5.9e+84) || !(d3 <= 8.5e+160)) 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 <= -5.9e+84) || ~((d3 <= 8.5e+160))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -5.9e+84], N[Not[LessEqual[d3, 8.5e+160]], $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 -5.9 \cdot 10^{+84} \lor \neg \left(d3 \leq 8.5 \cdot 10^{+160}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -5.89999999999999984e84 or 8.49999999999999982e160 < d3 Initial program 79.2%
associate--l+79.2%
distribute-lft-out--83.1%
distribute-rgt-out--85.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 90.9%
Taylor expanded in d2 around 0 86.1%
if -5.89999999999999984e84 < d3 < 8.49999999999999982e160Initial program 94.9%
associate--l+94.9%
distribute-lft-out--94.9%
distribute-rgt-out--96.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.5%
Final simplification92.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -6.3e+90) (not (<= d1 9800000000000.0))) (* d1 (- (+ d2 d4) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -6.3e+90) || !(d1 <= 9800000000000.0)) {
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 <= (-6.3d+90)) .or. (.not. (d1 <= 9800000000000.0d0))) 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 <= -6.3e+90) || !(d1 <= 9800000000000.0)) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -6.3e+90) or not (d1 <= 9800000000000.0): tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -6.3e+90) || !(d1 <= 9800000000000.0)) 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 <= -6.3e+90) || ~((d1 <= 9800000000000.0))) 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, -6.3e+90], N[Not[LessEqual[d1, 9800000000000.0]], $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 -6.3 \cdot 10^{+90} \lor \neg \left(d1 \leq 9800000000000\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 < -6.3e90 or 9.8e12 < d1 Initial program 77.7%
associate--l+77.7%
distribute-lft-out--79.6%
distribute-rgt-out--84.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.8%
if -6.3e90 < d1 < 9.8e12Initial program 99.3%
associate--l+99.3%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 96.6%
Final simplification94.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 -1.2e-158) (* d1 d2) (if (<= d4 3e+33) (* d1 (- d1)) (if (<= d4 2.8e+72) (* d1 d2) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.2e-158) {
tmp = d1 * d2;
} else if (d4 <= 3e+33) {
tmp = d1 * -d1;
} else if (d4 <= 2.8e+72) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= (-1.2d-158)) then
tmp = d1 * d2
else if (d4 <= 3d+33) then
tmp = d1 * -d1
else if (d4 <= 2.8d+72) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.2e-158) {
tmp = d1 * d2;
} else if (d4 <= 3e+33) {
tmp = d1 * -d1;
} else if (d4 <= 2.8e+72) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -1.2e-158: tmp = d1 * d2 elif d4 <= 3e+33: tmp = d1 * -d1 elif d4 <= 2.8e+72: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -1.2e-158) tmp = Float64(d1 * d2); elseif (d4 <= 3e+33) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 2.8e+72) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= -1.2e-158) tmp = d1 * d2; elseif (d4 <= 3e+33) tmp = d1 * -d1; elseif (d4 <= 2.8e+72) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -1.2e-158], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 3e+33], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 2.8e+72], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -1.2 \cdot 10^{-158}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 3 \cdot 10^{+33}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 2.8 \cdot 10^{+72}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -1.20000000000000004e-158 or 2.99999999999999984e33 < d4 < 2.7999999999999999e72Initial program 92.2%
associate--l+92.2%
distribute-lft-out--92.2%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 26.9%
if -1.20000000000000004e-158 < d4 < 2.99999999999999984e33Initial program 88.6%
associate--l+88.6%
distribute-lft-out--91.5%
distribute-rgt-out--91.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 50.0%
unpow250.0%
mul-1-neg50.0%
distribute-rgt-neg-out50.0%
Simplified50.0%
if 2.7999999999999999e72 < d4 Initial program 90.0%
associate--l+90.0%
distribute-lft-out--90.0%
distribute-rgt-out--98.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 62.4%
Final simplification44.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.65e+72) (* d1 (+ d2 d4)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.65e+72) {
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.65d+72)) 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.65e+72) {
tmp = d1 * (d2 + d4);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.65e+72: tmp = d1 * (d2 + d4) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.65e+72) 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.65e+72) tmp = d1 * (d2 + d4); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.65e+72], 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.65 \cdot 10^{+72}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.65e72Initial program 90.8%
associate--l+90.8%
distribute-lft-out--93.9%
distribute-rgt-out--93.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 79.3%
Taylor expanded in d1 around 0 73.2%
if -1.65e72 < d2 Initial program 90.1%
associate--l+90.1%
distribute-lft-out--91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in d2 around 0 77.8%
unpow277.8%
associate--l+77.8%
distribute-lft-out--80.1%
associate-*r*80.1%
neg-mul-180.1%
fma-def84.6%
Simplified84.6%
Taylor expanded in d3 around 0 64.6%
Final simplification65.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.12e-29) (* d1 (- d2 d1)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.12e-29) {
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 <= (-1.12d-29)) 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 <= -1.12e-29) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.12e-29: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.12e-29) 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 <= -1.12e-29) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.12e-29], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.12 \cdot 10^{-29}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.11999999999999995e-29Initial program 88.6%
associate--l+88.6%
distribute-lft-out--90.2%
distribute-rgt-out--91.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 73.9%
Taylor expanded in d4 around 0 58.9%
if -1.11999999999999995e-29 < d2 Initial program 90.7%
associate--l+90.7%
distribute-lft-out--91.7%
*-commutative91.7%
Simplified91.7%
Taylor expanded in d2 around 0 78.9%
unpow278.9%
associate--l+78.9%
distribute-lft-out--80.9%
associate-*r*80.9%
neg-mul-180.9%
fma-def85.1%
Simplified85.1%
Taylor expanded in d3 around 0 66.4%
Final simplification64.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -3.6e+39) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3.6e+39) {
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 <= (-3.6d+39)) 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 <= -3.6e+39) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -3.6e+39: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -3.6e+39) 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 <= -3.6e+39) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -3.6e+39], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -3.6 \cdot 10^{+39}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -3.59999999999999984e39Initial program 90.6%
associate--l+90.6%
distribute-lft-out--92.9%
distribute-rgt-out--95.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 52.2%
if -3.59999999999999984e39 < d2 Initial program 90.1%
associate--l+90.1%
distribute-lft-out--91.1%
distribute-rgt-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 36.9%
Final simplification39.4%
(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 90.2%
associate--l+90.2%
distribute-lft-out--91.4%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 34.2%
Final simplification34.2%
(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 2023230
(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)))