
(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 (+ (- d4 d1) (- d2 d3))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - d1) + (d2 - d3));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d4 - d1) + (d2 - d3))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - d1) + (d2 - d3));
}
def code(d1, d2, d3, d4): return d1 * ((d4 - d1) + (d2 - d3))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d4 - d1) + Float64(d2 - d3))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d4 - d1) + (d2 - d3)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d4 - d1), $MachinePrecision] + N[(d2 - d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d4 - d1\right) + \left(d2 - d3\right)\right)
\end{array}
Initial program 88.3%
associate--l+88.3%
+-commutative88.3%
distribute-rgt-out--91.4%
distribute-lft-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (- (* d1 d1))) (t_1 (* d1 (- d3))))
(if (<= d2 -2.25e+73)
(* d1 d2)
(if (<= d2 -2.7e-23)
t_1
(if (<= d2 -7.8e-84)
t_0
(if (<= d2 -8.6e-112)
t_1
(if (<= d2 -8e-129)
t_0
(if (<= d2 -9e-181)
(* d1 d4)
(if (<= d2 -8.5e-226)
t_1
(if (<= d2 4.2e-292) t_0 (* d1 d4)))))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = -(d1 * d1);
double t_1 = d1 * -d3;
double tmp;
if (d2 <= -2.25e+73) {
tmp = d1 * d2;
} else if (d2 <= -2.7e-23) {
tmp = t_1;
} else if (d2 <= -7.8e-84) {
tmp = t_0;
} else if (d2 <= -8.6e-112) {
tmp = t_1;
} else if (d2 <= -8e-129) {
tmp = t_0;
} else if (d2 <= -9e-181) {
tmp = d1 * d4;
} else if (d2 <= -8.5e-226) {
tmp = t_1;
} else if (d2 <= 4.2e-292) {
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) :: t_1
real(8) :: tmp
t_0 = -(d1 * d1)
t_1 = d1 * -d3
if (d2 <= (-2.25d+73)) then
tmp = d1 * d2
else if (d2 <= (-2.7d-23)) then
tmp = t_1
else if (d2 <= (-7.8d-84)) then
tmp = t_0
else if (d2 <= (-8.6d-112)) then
tmp = t_1
else if (d2 <= (-8d-129)) then
tmp = t_0
else if (d2 <= (-9d-181)) then
tmp = d1 * d4
else if (d2 <= (-8.5d-226)) then
tmp = t_1
else if (d2 <= 4.2d-292) 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 t_1 = d1 * -d3;
double tmp;
if (d2 <= -2.25e+73) {
tmp = d1 * d2;
} else if (d2 <= -2.7e-23) {
tmp = t_1;
} else if (d2 <= -7.8e-84) {
tmp = t_0;
} else if (d2 <= -8.6e-112) {
tmp = t_1;
} else if (d2 <= -8e-129) {
tmp = t_0;
} else if (d2 <= -9e-181) {
tmp = d1 * d4;
} else if (d2 <= -8.5e-226) {
tmp = t_1;
} else if (d2 <= 4.2e-292) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = -(d1 * d1) t_1 = d1 * -d3 tmp = 0 if d2 <= -2.25e+73: tmp = d1 * d2 elif d2 <= -2.7e-23: tmp = t_1 elif d2 <= -7.8e-84: tmp = t_0 elif d2 <= -8.6e-112: tmp = t_1 elif d2 <= -8e-129: tmp = t_0 elif d2 <= -9e-181: tmp = d1 * d4 elif d2 <= -8.5e-226: tmp = t_1 elif d2 <= 4.2e-292: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(-Float64(d1 * d1)) t_1 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d2 <= -2.25e+73) tmp = Float64(d1 * d2); elseif (d2 <= -2.7e-23) tmp = t_1; elseif (d2 <= -7.8e-84) tmp = t_0; elseif (d2 <= -8.6e-112) tmp = t_1; elseif (d2 <= -8e-129) tmp = t_0; elseif (d2 <= -9e-181) tmp = Float64(d1 * d4); elseif (d2 <= -8.5e-226) tmp = t_1; elseif (d2 <= 4.2e-292) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = -(d1 * d1); t_1 = d1 * -d3; tmp = 0.0; if (d2 <= -2.25e+73) tmp = d1 * d2; elseif (d2 <= -2.7e-23) tmp = t_1; elseif (d2 <= -7.8e-84) tmp = t_0; elseif (d2 <= -8.6e-112) tmp = t_1; elseif (d2 <= -8e-129) tmp = t_0; elseif (d2 <= -9e-181) tmp = d1 * d4; elseif (d2 <= -8.5e-226) tmp = t_1; elseif (d2 <= 4.2e-292) 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])}, Block[{t$95$1 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d2, -2.25e+73], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -2.7e-23], t$95$1, If[LessEqual[d2, -7.8e-84], t$95$0, If[LessEqual[d2, -8.6e-112], t$95$1, If[LessEqual[d2, -8e-129], t$95$0, If[LessEqual[d2, -9e-181], N[(d1 * d4), $MachinePrecision], If[LessEqual[d2, -8.5e-226], t$95$1, If[LessEqual[d2, 4.2e-292], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -d1 \cdot d1\\
t_1 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d2 \leq -2.25 \cdot 10^{+73}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -2.7 \cdot 10^{-23}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -7.8 \cdot 10^{-84}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -8.6 \cdot 10^{-112}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -8 \cdot 10^{-129}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -9 \cdot 10^{-181}:\\
\;\;\;\;d1 \cdot d4\\
\mathbf{elif}\;d2 \leq -8.5 \cdot 10^{-226}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq 4.2 \cdot 10^{-292}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -2.24999999999999992e73Initial program 80.3%
associate--l+80.3%
+-commutative80.3%
distribute-rgt-out--82.1%
distribute-lft-out--85.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 77.8%
if -2.24999999999999992e73 < d2 < -2.69999999999999985e-23 or -7.80000000000000045e-84 < d2 < -8.5999999999999996e-112 or -8.9999999999999998e-181 < d2 < -8.4999999999999998e-226Initial program 92.3%
associate--l+92.3%
+-commutative92.3%
distribute-rgt-out--92.3%
distribute-lft-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 58.1%
neg-mul-158.1%
distribute-lft-neg-in58.1%
Simplified58.1%
if -2.69999999999999985e-23 < d2 < -7.80000000000000045e-84 or -8.5999999999999996e-112 < d2 < -7.9999999999999994e-129 or -8.4999999999999998e-226 < d2 < 4.19999999999999977e-292Initial program 86.3%
associate--l+86.3%
+-commutative86.3%
distribute-rgt-out--95.4%
distribute-lft-out--95.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d1 around inf 53.4%
neg-mul-153.4%
Simplified53.4%
if -7.9999999999999994e-129 < d2 < -8.9999999999999998e-181 or 4.19999999999999977e-292 < d2 Initial program 91.4%
associate--l+91.4%
+-commutative91.4%
distribute-rgt-out--94.0%
distribute-lft-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 36.0%
Final simplification51.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (or (<= d3 -1.5e+129)
(and (not (<= d3 -8.5e+99))
(or (<= d3 -2.8e+44) (not (<= d3 8.5e+123)))))
(* d1 (- d3))
(* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.5e+129) || (!(d3 <= -8.5e+99) && ((d3 <= -2.8e+44) || !(d3 <= 8.5e+123)))) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-1.5d+129)) .or. (.not. (d3 <= (-8.5d+99))) .and. (d3 <= (-2.8d+44)) .or. (.not. (d3 <= 8.5d+123))) then
tmp = d1 * -d3
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.5e+129) || (!(d3 <= -8.5e+99) && ((d3 <= -2.8e+44) || !(d3 <= 8.5e+123)))) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.5e+129) or (not (d3 <= -8.5e+99) and ((d3 <= -2.8e+44) or not (d3 <= 8.5e+123))): tmp = d1 * -d3 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.5e+129) || (!(d3 <= -8.5e+99) && ((d3 <= -2.8e+44) || !(d3 <= 8.5e+123)))) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.5e+129) || (~((d3 <= -8.5e+99)) && ((d3 <= -2.8e+44) || ~((d3 <= 8.5e+123))))) tmp = d1 * -d3; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.5e+129], And[N[Not[LessEqual[d3, -8.5e+99]], $MachinePrecision], Or[LessEqual[d3, -2.8e+44], N[Not[LessEqual[d3, 8.5e+123]], $MachinePrecision]]]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.5 \cdot 10^{+129} \lor \neg \left(d3 \leq -8.5 \cdot 10^{+99}\right) \land \left(d3 \leq -2.8 \cdot 10^{+44} \lor \neg \left(d3 \leq 8.5 \cdot 10^{+123}\right)\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d3 < -1.50000000000000015e129 or -8.49999999999999984e99 < d3 < -2.8000000000000001e44 or 8.5e123 < d3 Initial program 82.5%
associate--l+82.5%
+-commutative82.5%
distribute-rgt-out--83.7%
distribute-lft-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 73.3%
neg-mul-173.3%
distribute-lft-neg-in73.3%
Simplified73.3%
if -1.50000000000000015e129 < d3 < -8.49999999999999984e99 or -2.8000000000000001e44 < d3 < 8.5e123Initial program 90.9%
sub-neg90.9%
associate-+l+90.9%
*-commutative90.9%
+-commutative90.9%
*-commutative90.9%
sub-neg90.9%
+-commutative90.9%
associate--l+90.9%
distribute-lft-out--90.9%
fma-def94.3%
distribute-rgt-out--98.3%
Simplified98.3%
Taylor expanded in d3 around 0 88.5%
Taylor expanded in d1 around 0 74.5%
Final simplification74.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -2.1e-20)
(* d1 (- d2 d3))
(if (or (<= d2 -5e-83) (and (not (<= d2 -4.3e-227)) (<= d2 6.7e-302)))
(* d1 (- d4 d1))
(* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.1e-20) {
tmp = d1 * (d2 - d3);
} else if ((d2 <= -5e-83) || (!(d2 <= -4.3e-227) && (d2 <= 6.7e-302))) {
tmp = d1 * (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 (d2 <= (-2.1d-20)) then
tmp = d1 * (d2 - d3)
else if ((d2 <= (-5d-83)) .or. (.not. (d2 <= (-4.3d-227))) .and. (d2 <= 6.7d-302)) then
tmp = d1 * (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 (d2 <= -2.1e-20) {
tmp = d1 * (d2 - d3);
} else if ((d2 <= -5e-83) || (!(d2 <= -4.3e-227) && (d2 <= 6.7e-302))) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.1e-20: tmp = d1 * (d2 - d3) elif (d2 <= -5e-83) or (not (d2 <= -4.3e-227) and (d2 <= 6.7e-302)): tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.1e-20) tmp = Float64(d1 * Float64(d2 - d3)); elseif ((d2 <= -5e-83) || (!(d2 <= -4.3e-227) && (d2 <= 6.7e-302))) tmp = Float64(d1 * Float64(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 (d2 <= -2.1e-20) tmp = d1 * (d2 - d3); elseif ((d2 <= -5e-83) || (~((d2 <= -4.3e-227)) && (d2 <= 6.7e-302))) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.1e-20], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d2, -5e-83], And[N[Not[LessEqual[d2, -4.3e-227]], $MachinePrecision], LessEqual[d2, 6.7e-302]]], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.1 \cdot 10^{-20}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -5 \cdot 10^{-83} \lor \neg \left(d2 \leq -4.3 \cdot 10^{-227}\right) \land d2 \leq 6.7 \cdot 10^{-302}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -2.0999999999999999e-20Initial program 83.3%
associate--l+83.3%
+-commutative83.3%
distribute-rgt-out--84.7%
distribute-lft-out--88.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.6%
+-commutative81.6%
associate--r+81.6%
Simplified81.6%
Taylor expanded in d1 around 0 76.2%
if -2.0999999999999999e-20 < d2 < -5e-83 or -4.3000000000000002e-227 < d2 < 6.70000000000000042e-302Initial program 87.8%
sub-neg87.8%
associate-+l+87.8%
*-commutative87.8%
+-commutative87.8%
*-commutative87.8%
sub-neg87.8%
+-commutative87.8%
associate--l+87.8%
distribute-lft-out--93.9%
fma-def100.0%
distribute-rgt-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 78.7%
Taylor expanded in d2 around 0 78.7%
+-commutative78.7%
mul-1-neg78.7%
unpow278.7%
distribute-rgt-neg-out78.7%
distribute-lft-in84.8%
sub-neg84.8%
Simplified84.8%
if -5e-83 < d2 < -4.3000000000000002e-227 or 6.70000000000000042e-302 < d2 Initial program 90.7%
associate--l+90.7%
+-commutative90.7%
distribute-rgt-out--94.0%
distribute-lft-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 78.4%
+-commutative78.4%
associate--r+78.4%
Simplified78.4%
Taylor expanded in d1 around 0 61.8%
Final simplification68.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -5.2e+30) (not (<= d3 9.8e+114))) (* d1 (- d2 d3)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -5.2e+30) || !(d3 <= 9.8e+114)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * ((d4 + d2) - 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.2d+30)) .or. (.not. (d3 <= 9.8d+114))) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * ((d4 + d2) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -5.2e+30) || !(d3 <= 9.8e+114)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -5.2e+30) or not (d3 <= 9.8e+114): tmp = d1 * (d2 - d3) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -5.2e+30) || !(d3 <= 9.8e+114)) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -5.2e+30) || ~((d3 <= 9.8e+114))) tmp = d1 * (d2 - d3); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -5.2e+30], N[Not[LessEqual[d3, 9.8e+114]], $MachinePrecision]], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -5.2 \cdot 10^{+30} \lor \neg \left(d3 \leq 9.8 \cdot 10^{+114}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -5.19999999999999977e30 or 9.8000000000000002e114 < d3 Initial program 83.3%
associate--l+83.3%
+-commutative83.3%
distribute-rgt-out--85.4%
distribute-lft-out--89.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.2%
+-commutative86.2%
associate--r+86.2%
Simplified86.2%
Taylor expanded in d1 around 0 81.0%
if -5.19999999999999977e30 < d3 < 9.8000000000000002e114Initial program 91.2%
associate--l+91.2%
+-commutative91.2%
distribute-rgt-out--95.0%
distribute-lft-out--95.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.0%
Final simplification90.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3e-44) (* d1 (- d2 d3)) (if (<= d4 4e+41) (* (+ d1 d3) (- d1)) (* d1 (+ d4 d2)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3e-44) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 4e+41) {
tmp = (d1 + d3) * -d1;
} else {
tmp = d1 * (d4 + d2);
}
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 <= 3d-44) then
tmp = d1 * (d2 - d3)
else if (d4 <= 4d+41) then
tmp = (d1 + d3) * -d1
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3e-44) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 4e+41) {
tmp = (d1 + d3) * -d1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3e-44: tmp = d1 * (d2 - d3) elif d4 <= 4e+41: tmp = (d1 + d3) * -d1 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3e-44) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 4e+41) tmp = Float64(Float64(d1 + d3) * Float64(-d1)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 3e-44) tmp = d1 * (d2 - d3); elseif (d4 <= 4e+41) tmp = (d1 + d3) * -d1; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3e-44], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 4e+41], N[(N[(d1 + d3), $MachinePrecision] * (-d1)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3 \cdot 10^{-44}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 4 \cdot 10^{+41}:\\
\;\;\;\;\left(d1 + d3\right) \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 3.0000000000000002e-44Initial program 91.4%
associate--l+91.4%
+-commutative91.4%
distribute-rgt-out--92.4%
distribute-lft-out--94.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.2%
+-commutative81.2%
associate--r+81.2%
Simplified81.2%
Taylor expanded in d1 around 0 64.7%
if 3.0000000000000002e-44 < d4 < 4.00000000000000002e41Initial program 84.2%
associate--l+84.2%
+-commutative84.2%
distribute-rgt-out--84.2%
distribute-lft-out--84.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.7%
+-commutative89.7%
associate--r+89.7%
Simplified89.7%
Taylor expanded in d2 around 0 74.1%
mul-1-neg74.1%
*-commutative74.1%
distribute-rgt-neg-in74.1%
Simplified74.1%
if 4.00000000000000002e41 < d4 Initial program 78.4%
sub-neg78.4%
associate-+l+78.4%
*-commutative78.4%
+-commutative78.4%
*-commutative78.4%
sub-neg78.4%
+-commutative78.4%
associate--l+78.4%
distribute-lft-out--78.4%
fma-def86.2%
distribute-rgt-out--98.0%
Simplified98.0%
Taylor expanded in d3 around 0 70.4%
Taylor expanded in d1 around 0 77.0%
Final simplification67.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 8.4e+51) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.4e+51) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 + d2) - 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 <= 8.4d+51) then
tmp = d1 * ((d2 - d3) - d1)
else
tmp = d1 * ((d4 + d2) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.4e+51) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 8.4e+51: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 8.4e+51) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 8.4e+51) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 8.4e+51], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 8.4 \cdot 10^{+51}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d4 < 8.4000000000000005e51Initial program 90.8%
associate--l+90.8%
+-commutative90.8%
distribute-rgt-out--91.8%
distribute-lft-out--93.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.2%
+-commutative82.2%
associate--r+82.2%
Simplified82.2%
if 8.4000000000000005e51 < d4 Initial program 77.1%
associate--l+77.1%
+-commutative77.1%
distribute-rgt-out--89.6%
distribute-lft-out--89.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 89.1%
Final simplification83.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -3.2e+129) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3.2e+129) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - 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 <= (-3.2d+129)) then
tmp = d1 * ((d2 - d3) - d1)
else
tmp = d1 * ((d4 - d3) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3.2e+129) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -3.2e+129: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -3.2e+129) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(d4 - d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -3.2e+129) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -3.2e+129], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -3.2 \cdot 10^{+129}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d2 < -3.2000000000000002e129Initial program 76.7%
associate--l+76.7%
+-commutative76.7%
distribute-rgt-out--79.0%
distribute-lft-out--81.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 91.4%
+-commutative91.4%
associate--r+91.4%
Simplified91.4%
if -3.2000000000000002e129 < d2 Initial program 90.6%
associate--l+90.6%
+-commutative90.6%
distribute-rgt-out--93.9%
distribute-lft-out--95.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 82.9%
+-commutative82.9%
associate--r+82.9%
Simplified82.9%
Final simplification84.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -7.5e-20) (* d1 d2) (if (<= d2 -9e-129) (- (* d1 d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -7.5e-20) {
tmp = d1 * d2;
} else if (d2 <= -9e-129) {
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 (d2 <= (-7.5d-20)) then
tmp = d1 * d2
else if (d2 <= (-9d-129)) 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 (d2 <= -7.5e-20) {
tmp = d1 * d2;
} else if (d2 <= -9e-129) {
tmp = -(d1 * d1);
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -7.5e-20: tmp = d1 * d2 elif d2 <= -9e-129: tmp = -(d1 * d1) else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -7.5e-20) tmp = Float64(d1 * d2); elseif (d2 <= -9e-129) tmp = Float64(-Float64(d1 * d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -7.5e-20) tmp = d1 * d2; elseif (d2 <= -9e-129) tmp = -(d1 * d1); else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -7.5e-20], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -9e-129], (-N[(d1 * d1), $MachinePrecision]), N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -7.5 \cdot 10^{-20}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -9 \cdot 10^{-129}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -7.49999999999999981e-20Initial program 83.1%
associate--l+83.1%
+-commutative83.1%
distribute-rgt-out--84.5%
distribute-lft-out--88.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 64.9%
if -7.49999999999999981e-20 < d2 < -9.00000000000000061e-129Initial program 79.9%
associate--l+79.9%
+-commutative79.9%
distribute-rgt-out--89.9%
distribute-lft-out--89.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d1 around inf 50.6%
neg-mul-150.6%
Simplified50.6%
if -9.00000000000000061e-129 < d2 Initial program 92.2%
associate--l+92.2%
+-commutative92.2%
distribute-rgt-out--94.8%
distribute-lft-out--95.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 36.4%
Final simplification45.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 5.8e+52) (* d1 (- d2 d3)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5.8e+52) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 + d2);
}
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.8d+52) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5.8e+52) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 5.8e+52: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 5.8e+52) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 5.8e+52) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 5.8e+52], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 5.8 \cdot 10^{+52}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 5.8e52Initial program 90.8%
associate--l+90.8%
+-commutative90.8%
distribute-rgt-out--91.8%
distribute-lft-out--93.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.2%
+-commutative82.2%
associate--r+82.2%
Simplified82.2%
Taylor expanded in d1 around 0 64.3%
if 5.8e52 < d4 Initial program 77.1%
sub-neg77.1%
associate-+l+77.1%
*-commutative77.1%
+-commutative77.1%
*-commutative77.1%
sub-neg77.1%
+-commutative77.1%
associate--l+77.1%
distribute-lft-out--77.1%
fma-def85.4%
distribute-rgt-out--97.9%
Simplified97.9%
Taylor expanded in d3 around 0 72.5%
Taylor expanded in d1 around 0 79.5%
Final simplification67.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.2e+25) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.2e+25) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-2.2d+25)) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.2e+25) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.2e+25: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.2e+25) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.2e+25) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.2e+25], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.2 \cdot 10^{+25}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -2.2000000000000001e25Initial program 81.5%
associate--l+81.5%
+-commutative81.5%
distribute-rgt-out--83.0%
distribute-lft-out--87.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 70.6%
if -2.2000000000000001e25 < d2 Initial program 90.6%
associate--l+90.6%
+-commutative90.6%
distribute-rgt-out--94.2%
distribute-lft-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 34.6%
Final simplification43.7%
(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.3%
associate--l+88.3%
+-commutative88.3%
distribute-rgt-out--91.4%
distribute-lft-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 37.5%
Final simplification37.5%
(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 2023322
(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)))