
(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.7%
associate--l+88.7%
+-commutative88.7%
distribute-rgt-out--91.4%
distribute-lft-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 1.3e-298)
t_0
(if (<= d4 3.2e-253)
(* d1 (- d2 d1))
(if (<= d4 1.2e-205)
t_0
(if (<= d4 1.45e+34) (* d1 (- (- d1) d3)) (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 1.3e-298) {
tmp = t_0;
} else if (d4 <= 3.2e-253) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.2e-205) {
tmp = t_0;
} else if (d4 <= 1.45e+34) {
tmp = d1 * (-d1 - d3);
} 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) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 1.3d-298) then
tmp = t_0
else if (d4 <= 3.2d-253) then
tmp = d1 * (d2 - d1)
else if (d4 <= 1.2d-205) then
tmp = t_0
else if (d4 <= 1.45d+34) then
tmp = d1 * (-d1 - d3)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 1.3e-298) {
tmp = t_0;
} else if (d4 <= 3.2e-253) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.2e-205) {
tmp = t_0;
} else if (d4 <= 1.45e+34) {
tmp = d1 * (-d1 - d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 1.3e-298: tmp = t_0 elif d4 <= 3.2e-253: tmp = d1 * (d2 - d1) elif d4 <= 1.2e-205: tmp = t_0 elif d4 <= 1.45e+34: tmp = d1 * (-d1 - d3) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 1.3e-298) tmp = t_0; elseif (d4 <= 3.2e-253) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 1.2e-205) tmp = t_0; elseif (d4 <= 1.45e+34) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 1.3e-298) tmp = t_0; elseif (d4 <= 3.2e-253) tmp = d1 * (d2 - d1); elseif (d4 <= 1.2e-205) tmp = t_0; elseif (d4 <= 1.45e+34) tmp = d1 * (-d1 - d3); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 1.3e-298], t$95$0, If[LessEqual[d4, 3.2e-253], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.2e-205], t$95$0, If[LessEqual[d4, 1.45e+34], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 1.3 \cdot 10^{-298}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 3.2 \cdot 10^{-253}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 1.2 \cdot 10^{-205}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.45 \cdot 10^{+34}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 1.2999999999999999e-298 or 3.1999999999999997e-253 < d4 < 1.2000000000000001e-205Initial program 91.4%
associate--l+91.4%
+-commutative91.4%
distribute-rgt-out--93.0%
distribute-lft-out--94.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 77.1%
+-commutative77.1%
associate--r+77.1%
Simplified77.1%
Taylor expanded in d1 around 0 57.8%
if 1.2999999999999999e-298 < d4 < 3.1999999999999997e-253Initial program 100.0%
associate--l+100.0%
+-commutative100.0%
distribute-rgt-out--100.0%
distribute-lft-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d3 around 0 64.7%
if 1.2000000000000001e-205 < d4 < 1.4500000000000001e34Initial program 90.0%
associate--l+90.0%
+-commutative90.0%
distribute-rgt-out--92.0%
distribute-lft-out--91.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 99.3%
+-commutative99.3%
associate--r+99.3%
Simplified99.3%
Taylor expanded in d2 around 0 72.7%
neg-mul-172.7%
distribute-rgt-neg-in72.7%
+-commutative72.7%
distribute-neg-in72.7%
sub-neg72.7%
Simplified72.7%
if 1.4500000000000001e34 < d4 Initial program 80.6%
associate--l+80.6%
+-commutative80.6%
distribute-rgt-out--86.6%
distribute-lft-out--86.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.6%
+-commutative85.6%
associate--r+85.6%
Simplified85.6%
Taylor expanded in d1 around 0 80.1%
Final simplification66.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 3.6e+59)
(* d1 (- d2 d1))
(if (or (<= d4 7.8e+79) (and (not (<= d4 3.2e+94)) (<= d4 5.5e+107)))
(* d3 (- d1))
(* d1 (+ d4 d2)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.6e+59) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 7.8e+79) || (!(d4 <= 3.2e+94) && (d4 <= 5.5e+107))) {
tmp = 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 <= 3.6d+59) then
tmp = d1 * (d2 - d1)
else if ((d4 <= 7.8d+79) .or. (.not. (d4 <= 3.2d+94)) .and. (d4 <= 5.5d+107)) then
tmp = 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 <= 3.6e+59) {
tmp = d1 * (d2 - d1);
} else if ((d4 <= 7.8e+79) || (!(d4 <= 3.2e+94) && (d4 <= 5.5e+107))) {
tmp = d3 * -d1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.6e+59: tmp = d1 * (d2 - d1) elif (d4 <= 7.8e+79) or (not (d4 <= 3.2e+94) and (d4 <= 5.5e+107)): tmp = d3 * -d1 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.6e+59) tmp = Float64(d1 * Float64(d2 - d1)); elseif ((d4 <= 7.8e+79) || (!(d4 <= 3.2e+94) && (d4 <= 5.5e+107))) tmp = Float64(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 <= 3.6e+59) tmp = d1 * (d2 - d1); elseif ((d4 <= 7.8e+79) || (~((d4 <= 3.2e+94)) && (d4 <= 5.5e+107))) tmp = d3 * -d1; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.6e+59], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d4, 7.8e+79], And[N[Not[LessEqual[d4, 3.2e+94]], $MachinePrecision], LessEqual[d4, 5.5e+107]]], N[(d3 * (-d1)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.6 \cdot 10^{+59}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 7.8 \cdot 10^{+79} \lor \neg \left(d4 \leq 3.2 \cdot 10^{+94}\right) \land d4 \leq 5.5 \cdot 10^{+107}:\\
\;\;\;\;d3 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 3.5999999999999999e59Initial program 91.2%
associate--l+91.2%
+-commutative91.2%
distribute-rgt-out--92.8%
distribute-lft-out--93.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.2%
+-commutative84.2%
associate--r+84.2%
Simplified84.2%
Taylor expanded in d3 around 0 57.4%
if 3.5999999999999999e59 < d4 < 7.7999999999999994e79 or 3.20000000000000014e94 < d4 < 5.5000000000000003e107Initial program 83.3%
associate--l+83.3%
+-commutative83.3%
distribute-rgt-out--91.7%
distribute-lft-out--91.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 68.5%
neg-mul-168.5%
distribute-lft-neg-in68.5%
Simplified68.5%
if 7.7999999999999994e79 < d4 < 3.20000000000000014e94 or 5.5000000000000003e107 < d4 Initial program 80.0%
associate--l+80.0%
+-commutative80.0%
distribute-rgt-out--86.0%
distribute-lft-out--86.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 90.5%
Taylor expanded in d1 around 0 80.7%
Final simplification62.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (+ d4 d2))))
(if (<= d3 -3e+90)
t_0
(if (<= d3 -5.8e-19)
t_1
(if (<= d3 -1.75e-87) (* d1 (- d2 d1)) (if (<= d3 1.1e+73) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -3e+90) {
tmp = t_0;
} else if (d3 <= -5.8e-19) {
tmp = t_1;
} else if (d3 <= -1.75e-87) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 1.1e+73) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * (d4 + d2)
if (d3 <= (-3d+90)) then
tmp = t_0
else if (d3 <= (-5.8d-19)) then
tmp = t_1
else if (d3 <= (-1.75d-87)) then
tmp = d1 * (d2 - d1)
else if (d3 <= 1.1d+73) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 + d2);
double tmp;
if (d3 <= -3e+90) {
tmp = t_0;
} else if (d3 <= -5.8e-19) {
tmp = t_1;
} else if (d3 <= -1.75e-87) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 1.1e+73) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d4 + d2) tmp = 0 if d3 <= -3e+90: tmp = t_0 elif d3 <= -5.8e-19: tmp = t_1 elif d3 <= -1.75e-87: tmp = d1 * (d2 - d1) elif d3 <= 1.1e+73: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d4 + d2)) tmp = 0.0 if (d3 <= -3e+90) tmp = t_0; elseif (d3 <= -5.8e-19) tmp = t_1; elseif (d3 <= -1.75e-87) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 1.1e+73) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d4 + d2); tmp = 0.0; if (d3 <= -3e+90) tmp = t_0; elseif (d3 <= -5.8e-19) tmp = t_1; elseif (d3 <= -1.75e-87) tmp = d1 * (d2 - d1); elseif (d3 <= 1.1e+73) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -3e+90], t$95$0, If[LessEqual[d3, -5.8e-19], t$95$1, If[LessEqual[d3, -1.75e-87], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.1e+73], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d4 + d2\right)\\
\mathbf{if}\;d3 \leq -3 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -5.8 \cdot 10^{-19}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -1.75 \cdot 10^{-87}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 1.1 \cdot 10^{+73}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -2.99999999999999979e90 or 1.1e73 < d3 Initial program 83.3%
associate--l+83.3%
+-commutative83.3%
distribute-rgt-out--85.3%
distribute-lft-out--87.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 87.6%
+-commutative87.6%
associate--r+87.6%
Simplified87.6%
Taylor expanded in d1 around 0 78.0%
if -2.99999999999999979e90 < d3 < -5.8e-19 or -1.75000000000000006e-87 < d3 < 1.1e73Initial program 91.9%
associate--l+91.9%
+-commutative91.9%
distribute-rgt-out--95.6%
distribute-lft-out--95.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.6%
Taylor expanded in d1 around 0 72.4%
if -5.8e-19 < d3 < -1.75000000000000006e-87Initial program 94.4%
associate--l+94.4%
+-commutative94.4%
distribute-rgt-out--94.4%
distribute-lft-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 79.1%
+-commutative79.1%
associate--r+79.1%
Simplified79.1%
Taylor expanded in d3 around 0 74.5%
Final simplification74.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -2.85e+88)
(* d1 d2)
(if (or (<= d2 -3.3e-28) (and (not (<= d2 -2e-58)) (<= d2 1.1e-196)))
(* d3 (- d1))
(* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.85e+88) {
tmp = d1 * d2;
} else if ((d2 <= -3.3e-28) || (!(d2 <= -2e-58) && (d2 <= 1.1e-196))) {
tmp = d3 * -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 <= (-2.85d+88)) then
tmp = d1 * d2
else if ((d2 <= (-3.3d-28)) .or. (.not. (d2 <= (-2d-58))) .and. (d2 <= 1.1d-196)) then
tmp = d3 * -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 <= -2.85e+88) {
tmp = d1 * d2;
} else if ((d2 <= -3.3e-28) || (!(d2 <= -2e-58) && (d2 <= 1.1e-196))) {
tmp = d3 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.85e+88: tmp = d1 * d2 elif (d2 <= -3.3e-28) or (not (d2 <= -2e-58) and (d2 <= 1.1e-196)): tmp = d3 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.85e+88) tmp = Float64(d1 * d2); elseif ((d2 <= -3.3e-28) || (!(d2 <= -2e-58) && (d2 <= 1.1e-196))) tmp = Float64(d3 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.85e+88) tmp = d1 * d2; elseif ((d2 <= -3.3e-28) || (~((d2 <= -2e-58)) && (d2 <= 1.1e-196))) tmp = d3 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.85e+88], N[(d1 * d2), $MachinePrecision], If[Or[LessEqual[d2, -3.3e-28], And[N[Not[LessEqual[d2, -2e-58]], $MachinePrecision], LessEqual[d2, 1.1e-196]]], N[(d3 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.85 \cdot 10^{+88}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -3.3 \cdot 10^{-28} \lor \neg \left(d2 \leq -2 \cdot 10^{-58}\right) \land d2 \leq 1.1 \cdot 10^{-196}:\\
\;\;\;\;d3 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -2.85000000000000011e88Initial program 82.2%
associate--l+82.2%
+-commutative82.2%
distribute-rgt-out--82.2%
distribute-lft-out--84.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 68.5%
if -2.85000000000000011e88 < d2 < -3.3000000000000002e-28 or -2.0000000000000001e-58 < d2 < 1.10000000000000007e-196Initial program 90.9%
associate--l+90.9%
+-commutative90.9%
distribute-rgt-out--95.0%
distribute-lft-out--95.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 41.4%
neg-mul-141.4%
distribute-lft-neg-in41.4%
Simplified41.4%
if -3.3000000000000002e-28 < d2 < -2.0000000000000001e-58 or 1.10000000000000007e-196 < d2 Initial program 88.9%
associate--l+88.9%
+-commutative88.9%
distribute-rgt-out--91.1%
distribute-lft-out--92.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 35.6%
Final simplification44.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -6.2e+90) (* d1 (- (- d1) d3)) (if (<= d3 6e+98) (* d1 (- (+ d4 d2) d1)) (* d1 (- d2 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -6.2e+90) {
tmp = d1 * (-d1 - d3);
} else if (d3 <= 6e+98) {
tmp = d1 * ((d4 + d2) - d1);
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d3 <= (-6.2d+90)) then
tmp = d1 * (-d1 - d3)
else if (d3 <= 6d+98) then
tmp = d1 * ((d4 + d2) - d1)
else
tmp = d1 * (d2 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -6.2e+90) {
tmp = d1 * (-d1 - d3);
} else if (d3 <= 6e+98) {
tmp = d1 * ((d4 + d2) - d1);
} else {
tmp = d1 * (d2 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -6.2e+90: tmp = d1 * (-d1 - d3) elif d3 <= 6e+98: tmp = d1 * ((d4 + d2) - d1) else: tmp = d1 * (d2 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -6.2e+90) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d3 <= 6e+98) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); else tmp = Float64(d1 * Float64(d2 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -6.2e+90) tmp = d1 * (-d1 - d3); elseif (d3 <= 6e+98) tmp = d1 * ((d4 + d2) - d1); else tmp = d1 * (d2 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -6.2e+90], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 6e+98], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -6.2 \cdot 10^{+90}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d3 \leq 6 \cdot 10^{+98}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\end{array}
\end{array}
if d3 < -6.19999999999999977e90Initial program 83.7%
associate--l+83.7%
+-commutative83.7%
distribute-rgt-out--83.7%
distribute-lft-out--85.7%
distribute-lft-out99.8%
Simplified99.8%
Taylor expanded in d4 around 0 92.4%
+-commutative92.4%
associate--r+92.4%
Simplified92.4%
Taylor expanded in d2 around 0 83.8%
neg-mul-183.8%
distribute-rgt-neg-in83.8%
+-commutative83.8%
distribute-neg-in83.8%
sub-neg83.8%
Simplified83.8%
if -6.19999999999999977e90 < d3 < 6.0000000000000003e98Initial program 91.3%
associate--l+91.3%
+-commutative91.3%
distribute-rgt-out--94.4%
distribute-lft-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.6%
if 6.0000000000000003e98 < d3 Initial program 84.8%
associate--l+84.8%
+-commutative84.8%
distribute-rgt-out--89.1%
distribute-lft-out--91.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.7%
+-commutative84.7%
associate--r+84.7%
Simplified84.7%
Taylor expanded in d1 around 0 75.1%
Final simplification89.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -7e+89) (not (<= d3 3e+98))) (* d3 (- d1)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -7e+89) || !(d3 <= 3e+98)) {
tmp = 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 ((d3 <= (-7d+89)) .or. (.not. (d3 <= 3d+98))) then
tmp = 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 ((d3 <= -7e+89) || !(d3 <= 3e+98)) {
tmp = d3 * -d1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -7e+89) or not (d3 <= 3e+98): tmp = d3 * -d1 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -7e+89) || !(d3 <= 3e+98)) tmp = Float64(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 ((d3 <= -7e+89) || ~((d3 <= 3e+98))) tmp = d3 * -d1; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -7e+89], N[Not[LessEqual[d3, 3e+98]], $MachinePrecision]], N[(d3 * (-d1)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -7 \cdot 10^{+89} \lor \neg \left(d3 \leq 3 \cdot 10^{+98}\right):\\
\;\;\;\;d3 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d3 < -7.0000000000000001e89 or 3.0000000000000001e98 < d3 Initial program 83.3%
associate--l+83.3%
+-commutative83.3%
distribute-rgt-out--85.4%
distribute-lft-out--87.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 68.8%
neg-mul-168.8%
distribute-lft-neg-in68.8%
Simplified68.8%
if -7.0000000000000001e89 < d3 < 3.0000000000000001e98Initial program 91.8%
associate--l+91.8%
+-commutative91.8%
distribute-rgt-out--95.0%
distribute-lft-out--95.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.6%
Taylor expanded in d1 around 0 69.9%
Final simplification69.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 6.8e+34) (* d1 (- (- d2 d3) d1)) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6.8e+34) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 6.8d+34) then
tmp = d1 * ((d2 - d3) - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6.8e+34) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 6.8e+34: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 6.8e+34) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 6.8e+34) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 6.8e+34], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 6.8 \cdot 10^{+34}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 6.7999999999999999e34Initial program 91.5%
associate--l+91.5%
+-commutative91.5%
distribute-rgt-out--93.1%
distribute-lft-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.3%
+-commutative84.3%
associate--r+84.3%
Simplified84.3%
if 6.7999999999999999e34 < d4 Initial program 80.6%
associate--l+80.6%
+-commutative80.6%
distribute-rgt-out--86.6%
distribute-lft-out--86.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.6%
+-commutative85.6%
associate--r+85.6%
Simplified85.6%
Taylor expanded in d1 around 0 80.1%
Final simplification83.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 9.1e+33) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 9.1e+33) {
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 (d4 <= 9.1d+33) 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 (d4 <= 9.1e+33) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 9.1e+33: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 9.1e+33) 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 (d4 <= 9.1e+33) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 9.1e+33], 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}\;d4 \leq 9.1 \cdot 10^{+33}:\\
\;\;\;\;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 d4 < 9.0999999999999997e33Initial program 91.5%
associate--l+91.5%
+-commutative91.5%
distribute-rgt-out--93.1%
distribute-lft-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.3%
+-commutative84.3%
associate--r+84.3%
Simplified84.3%
if 9.0999999999999997e33 < d4 Initial program 80.6%
associate--l+80.6%
+-commutative80.6%
distribute-rgt-out--86.6%
distribute-lft-out--86.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.6%
+-commutative85.6%
associate--r+85.6%
Simplified85.6%
Final simplification84.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.6e+20) (* d1 (- d2 d1)) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.6e+20) {
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 (d2 <= (-1.6d+20)) 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 (d2 <= -1.6e+20) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.6e+20: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.6e+20) 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 (d2 <= -1.6e+20) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.6e+20], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.6 \cdot 10^{+20}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -1.6e20Initial program 82.8%
associate--l+82.8%
+-commutative82.8%
distribute-rgt-out--82.8%
distribute-lft-out--84.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.7%
+-commutative81.7%
associate--r+81.7%
Simplified81.7%
Taylor expanded in d3 around 0 70.5%
if -1.6e20 < d2 Initial program 90.6%
associate--l+90.6%
+-commutative90.6%
distribute-rgt-out--94.3%
distribute-lft-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.6%
+-commutative85.6%
associate--r+85.6%
Simplified85.6%
Taylor expanded in d1 around 0 64.1%
Final simplification65.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.05e+34) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.05e+34) {
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.05d+34) 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.05e+34) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.05e+34: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.05e+34) 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.05e+34) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.05e+34], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.05 \cdot 10^{+34}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.05000000000000009e34Initial program 91.5%
associate--l+91.5%
+-commutative91.5%
distribute-rgt-out--93.1%
distribute-lft-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.9%
if 1.05000000000000009e34 < d4 Initial program 80.6%
associate--l+80.6%
+-commutative80.6%
distribute-rgt-out--86.6%
distribute-lft-out--86.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 61.4%
Final simplification38.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d2
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 88.7%
associate--l+88.7%
+-commutative88.7%
distribute-rgt-out--91.4%
distribute-lft-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 27.1%
Final simplification27.1%
(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 2023319
(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)))