
(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 86.3%
associate--l+86.3%
distribute-lft-out--87.1%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- (- d1) d3))) (t_1 (* d1 (- (+ d2 d4) d3))))
(if (<= d1 -1.6e+141)
t_0
(if (<= d1 -4.8e+106)
t_1
(if (<= d1 -9e+36)
(* d1 (- d4 d1))
(if (or (<= d1 2.45e+88)
(and (not (<= d1 1.45e+125)) (<= d1 6.9e+218)))
t_1
t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (-d1 - d3);
double t_1 = d1 * ((d2 + d4) - d3);
double tmp;
if (d1 <= -1.6e+141) {
tmp = t_0;
} else if (d1 <= -4.8e+106) {
tmp = t_1;
} else if (d1 <= -9e+36) {
tmp = d1 * (d4 - d1);
} else if ((d1 <= 2.45e+88) || (!(d1 <= 1.45e+125) && (d1 <= 6.9e+218))) {
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 - d3)
t_1 = d1 * ((d2 + d4) - d3)
if (d1 <= (-1.6d+141)) then
tmp = t_0
else if (d1 <= (-4.8d+106)) then
tmp = t_1
else if (d1 <= (-9d+36)) then
tmp = d1 * (d4 - d1)
else if ((d1 <= 2.45d+88) .or. (.not. (d1 <= 1.45d+125)) .and. (d1 <= 6.9d+218)) 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 - d3);
double t_1 = d1 * ((d2 + d4) - d3);
double tmp;
if (d1 <= -1.6e+141) {
tmp = t_0;
} else if (d1 <= -4.8e+106) {
tmp = t_1;
} else if (d1 <= -9e+36) {
tmp = d1 * (d4 - d1);
} else if ((d1 <= 2.45e+88) || (!(d1 <= 1.45e+125) && (d1 <= 6.9e+218))) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (-d1 - d3) t_1 = d1 * ((d2 + d4) - d3) tmp = 0 if d1 <= -1.6e+141: tmp = t_0 elif d1 <= -4.8e+106: tmp = t_1 elif d1 <= -9e+36: tmp = d1 * (d4 - d1) elif (d1 <= 2.45e+88) or (not (d1 <= 1.45e+125) and (d1 <= 6.9e+218)): tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(Float64(-d1) - d3)) t_1 = Float64(d1 * Float64(Float64(d2 + d4) - d3)) tmp = 0.0 if (d1 <= -1.6e+141) tmp = t_0; elseif (d1 <= -4.8e+106) tmp = t_1; elseif (d1 <= -9e+36) tmp = Float64(d1 * Float64(d4 - d1)); elseif ((d1 <= 2.45e+88) || (!(d1 <= 1.45e+125) && (d1 <= 6.9e+218))) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (-d1 - d3); t_1 = d1 * ((d2 + d4) - d3); tmp = 0.0; if (d1 <= -1.6e+141) tmp = t_0; elseif (d1 <= -4.8e+106) tmp = t_1; elseif (d1 <= -9e+36) tmp = d1 * (d4 - d1); elseif ((d1 <= 2.45e+88) || (~((d1 <= 1.45e+125)) && (d1 <= 6.9e+218))) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -1.6e+141], t$95$0, If[LessEqual[d1, -4.8e+106], t$95$1, If[LessEqual[d1, -9e+36], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d1, 2.45e+88], And[N[Not[LessEqual[d1, 1.45e+125]], $MachinePrecision], LessEqual[d1, 6.9e+218]]], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(\left(-d1\right) - d3\right)\\
t_1 := d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{if}\;d1 \leq -1.6 \cdot 10^{+141}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d1 \leq -4.8 \cdot 10^{+106}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d1 \leq -9 \cdot 10^{+36}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d1 \leq 2.45 \cdot 10^{+88} \lor \neg \left(d1 \leq 1.45 \cdot 10^{+125}\right) \land d1 \leq 6.9 \cdot 10^{+218}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d1 < -1.60000000000000009e141 or 2.4500000000000001e88 < d1 < 1.44999999999999997e125 or 6.9000000000000003e218 < d1 Initial program 58.3%
associate--l+58.3%
distribute-lft-out--60.0%
distribute-rgt-out--75.0%
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 d4 around 0 96.7%
associate-*r*96.7%
neg-mul-196.7%
*-commutative96.7%
Simplified96.7%
if -1.60000000000000009e141 < d1 < -4.8000000000000001e106 or -8.99999999999999994e36 < d1 < 2.4500000000000001e88 or 1.44999999999999997e125 < d1 < 6.9000000000000003e218Initial program 94.4%
associate--l+94.4%
distribute-lft-out--94.9%
distribute-rgt-out--95.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 93.6%
if -4.8000000000000001e106 < d1 < -8.99999999999999994e36Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 79.0%
+-commutative79.0%
associate--r+79.0%
Simplified79.0%
Taylor expanded in d3 around 0 62.3%
Final simplification92.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (- (* d1 d1))) (t_1 (* d1 (- d3))))
(if (<= d4 -2.2e-84)
(* d1 d2)
(if (<= d4 -2.05e-246)
t_1
(if (<= d4 8.2e-204)
t_0
(if (<= d4 1.05e-42)
t_1
(if (<= d4 86000000000000.0)
t_0
(if (<= d4 9.8e+57) t_1 (* 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 (d4 <= -2.2e-84) {
tmp = d1 * d2;
} else if (d4 <= -2.05e-246) {
tmp = t_1;
} else if (d4 <= 8.2e-204) {
tmp = t_0;
} else if (d4 <= 1.05e-42) {
tmp = t_1;
} else if (d4 <= 86000000000000.0) {
tmp = t_0;
} else if (d4 <= 9.8e+57) {
tmp = t_1;
} 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 (d4 <= (-2.2d-84)) then
tmp = d1 * d2
else if (d4 <= (-2.05d-246)) then
tmp = t_1
else if (d4 <= 8.2d-204) then
tmp = t_0
else if (d4 <= 1.05d-42) then
tmp = t_1
else if (d4 <= 86000000000000.0d0) then
tmp = t_0
else if (d4 <= 9.8d+57) then
tmp = t_1
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 (d4 <= -2.2e-84) {
tmp = d1 * d2;
} else if (d4 <= -2.05e-246) {
tmp = t_1;
} else if (d4 <= 8.2e-204) {
tmp = t_0;
} else if (d4 <= 1.05e-42) {
tmp = t_1;
} else if (d4 <= 86000000000000.0) {
tmp = t_0;
} else if (d4 <= 9.8e+57) {
tmp = t_1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = -(d1 * d1) t_1 = d1 * -d3 tmp = 0 if d4 <= -2.2e-84: tmp = d1 * d2 elif d4 <= -2.05e-246: tmp = t_1 elif d4 <= 8.2e-204: tmp = t_0 elif d4 <= 1.05e-42: tmp = t_1 elif d4 <= 86000000000000.0: tmp = t_0 elif d4 <= 9.8e+57: tmp = t_1 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 (d4 <= -2.2e-84) tmp = Float64(d1 * d2); elseif (d4 <= -2.05e-246) tmp = t_1; elseif (d4 <= 8.2e-204) tmp = t_0; elseif (d4 <= 1.05e-42) tmp = t_1; elseif (d4 <= 86000000000000.0) tmp = t_0; elseif (d4 <= 9.8e+57) tmp = t_1; 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 (d4 <= -2.2e-84) tmp = d1 * d2; elseif (d4 <= -2.05e-246) tmp = t_1; elseif (d4 <= 8.2e-204) tmp = t_0; elseif (d4 <= 1.05e-42) tmp = t_1; elseif (d4 <= 86000000000000.0) tmp = t_0; elseif (d4 <= 9.8e+57) tmp = t_1; 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[d4, -2.2e-84], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, -2.05e-246], t$95$1, If[LessEqual[d4, 8.2e-204], t$95$0, If[LessEqual[d4, 1.05e-42], t$95$1, If[LessEqual[d4, 86000000000000.0], t$95$0, If[LessEqual[d4, 9.8e+57], t$95$1, N[(d1 * d4), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -d1 \cdot d1\\
t_1 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq -2.2 \cdot 10^{-84}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq -2.05 \cdot 10^{-246}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 8.2 \cdot 10^{-204}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.05 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 86000000000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 9.8 \cdot 10^{+57}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -2.1999999999999999e-84Initial program 77.0%
associate--l+77.0%
distribute-lft-out--77.0%
distribute-rgt-out--85.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 27.3%
if -2.1999999999999999e-84 < d4 < -2.04999999999999993e-246 or 8.2000000000000002e-204 < d4 < 1.05000000000000003e-42 or 8.6e13 < d4 < 9.7999999999999998e57Initial program 91.7%
associate--l+91.7%
distribute-lft-out--92.9%
distribute-rgt-out--92.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 48.1%
mul-1-neg48.1%
*-commutative48.1%
distribute-rgt-neg-in48.1%
Simplified48.1%
if -2.04999999999999993e-246 < d4 < 8.2000000000000002e-204 or 1.05000000000000003e-42 < d4 < 8.6e13Initial program 90.7%
associate--l+90.7%
distribute-lft-out--93.0%
distribute-rgt-out--93.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 67.9%
+-commutative67.9%
associate--r+67.9%
Simplified67.9%
Taylor expanded in d1 around inf 34.5%
neg-mul-134.5%
Simplified34.5%
if 9.7999999999999998e57 < d4 Initial program 87.0%
associate--l+87.0%
distribute-lft-out--87.0%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 56.3%
Final simplification41.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d3))))
(if (<= d4 -1.45e-282)
(* d1 (- d2 d3))
(if (<= d4 2.5e+17)
(* d1 (- (- d1) d3))
(if (<= d4 2.6e+77)
t_0
(if (<= d4 3.2e+149)
(* d1 (- d4 d1))
(if (<= d4 3.5e+177) t_0 (* d1 (+ d2 d4)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double tmp;
if (d4 <= -1.45e-282) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 2.5e+17) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 2.6e+77) {
tmp = t_0;
} else if (d4 <= 3.2e+149) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 3.5e+177) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d4 - d3)
if (d4 <= (-1.45d-282)) then
tmp = d1 * (d2 - d3)
else if (d4 <= 2.5d+17) then
tmp = d1 * (-d1 - d3)
else if (d4 <= 2.6d+77) then
tmp = t_0
else if (d4 <= 3.2d+149) then
tmp = d1 * (d4 - d1)
else if (d4 <= 3.5d+177) then
tmp = t_0
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double tmp;
if (d4 <= -1.45e-282) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 2.5e+17) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 2.6e+77) {
tmp = t_0;
} else if (d4 <= 3.2e+149) {
tmp = d1 * (d4 - d1);
} else if (d4 <= 3.5e+177) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d3) tmp = 0 if d4 <= -1.45e-282: tmp = d1 * (d2 - d3) elif d4 <= 2.5e+17: tmp = d1 * (-d1 - d3) elif d4 <= 2.6e+77: tmp = t_0 elif d4 <= 3.2e+149: tmp = d1 * (d4 - d1) elif d4 <= 3.5e+177: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d3)) tmp = 0.0 if (d4 <= -1.45e-282) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 2.5e+17) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d4 <= 2.6e+77) tmp = t_0; elseif (d4 <= 3.2e+149) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d4 <= 3.5e+177) tmp = t_0; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d3); tmp = 0.0; if (d4 <= -1.45e-282) tmp = d1 * (d2 - d3); elseif (d4 <= 2.5e+17) tmp = d1 * (-d1 - d3); elseif (d4 <= 2.6e+77) tmp = t_0; elseif (d4 <= 3.2e+149) tmp = d1 * (d4 - d1); elseif (d4 <= 3.5e+177) tmp = t_0; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, -1.45e-282], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 2.5e+17], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 2.6e+77], t$95$0, If[LessEqual[d4, 3.2e+149], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 3.5e+177], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d3\right)\\
\mathbf{if}\;d4 \leq -1.45 \cdot 10^{-282}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 2.5 \cdot 10^{+17}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d4 \leq 2.6 \cdot 10^{+77}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 3.2 \cdot 10^{+149}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d4 \leq 3.5 \cdot 10^{+177}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -1.44999999999999999e-282Initial program 82.7%
associate--l+82.7%
distribute-lft-out--82.7%
distribute-rgt-out--87.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 78.1%
Taylor expanded in d4 around 0 56.3%
if -1.44999999999999999e-282 < d4 < 2.5e17Initial program 92.5%
associate--l+92.5%
distribute-lft-out--95.5%
distribute-rgt-out--95.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 68.1%
+-commutative68.1%
associate--r+68.1%
Simplified68.1%
Taylor expanded in d4 around 0 68.0%
associate-*r*68.0%
neg-mul-168.0%
*-commutative68.0%
Simplified68.0%
if 2.5e17 < d4 < 2.6000000000000002e77 or 3.2000000000000002e149 < d4 < 3.49999999999999991e177Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--87.5%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 87.9%
Taylor expanded in d2 around 0 69.6%
if 2.6000000000000002e77 < d4 < 3.2000000000000002e149Initial program 85.7%
associate--l+85.7%
distribute-lft-out--85.7%
distribute-rgt-out--90.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 68.7%
+-commutative68.7%
associate--r+68.7%
Simplified68.7%
Taylor expanded in d3 around 0 58.8%
if 3.49999999999999991e177 < d4 Initial program 88.0%
associate--l+88.0%
distribute-lft-out--88.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 92.0%
Taylor expanded in d3 around 0 88.2%
Final simplification63.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (or (<= d1 -5.7e+141)
(not
(or (<= d1 7.6e+88) (and (not (<= d1 8.2e+124)) (<= d1 1.6e+179)))))
(- (* d1 d1))
(* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5.7e+141) || !((d1 <= 7.6e+88) || (!(d1 <= 8.2e+124) && (d1 <= 1.6e+179)))) {
tmp = -(d1 * d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d1 <= (-5.7d+141)) .or. (.not. (d1 <= 7.6d+88) .or. (.not. (d1 <= 8.2d+124)) .and. (d1 <= 1.6d+179))) then
tmp = -(d1 * d1)
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -5.7e+141) || !((d1 <= 7.6e+88) || (!(d1 <= 8.2e+124) && (d1 <= 1.6e+179)))) {
tmp = -(d1 * d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -5.7e+141) or not ((d1 <= 7.6e+88) or (not (d1 <= 8.2e+124) and (d1 <= 1.6e+179))): tmp = -(d1 * d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -5.7e+141) || !((d1 <= 7.6e+88) || (!(d1 <= 8.2e+124) && (d1 <= 1.6e+179)))) tmp = Float64(-Float64(d1 * d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -5.7e+141) || ~(((d1 <= 7.6e+88) || (~((d1 <= 8.2e+124)) && (d1 <= 1.6e+179))))) tmp = -(d1 * d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -5.7e+141], N[Not[Or[LessEqual[d1, 7.6e+88], And[N[Not[LessEqual[d1, 8.2e+124]], $MachinePrecision], LessEqual[d1, 1.6e+179]]]], $MachinePrecision]], (-N[(d1 * d1), $MachinePrecision]), N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -5.7 \cdot 10^{+141} \lor \neg \left(d1 \leq 7.6 \cdot 10^{+88} \lor \neg \left(d1 \leq 8.2 \cdot 10^{+124}\right) \land d1 \leq 1.6 \cdot 10^{+179}\right):\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d1 < -5.69999999999999998e141 or 7.5999999999999993e88 < d1 < 8.20000000000000002e124 or 1.6000000000000001e179 < d1 Initial program 56.9%
associate--l+56.9%
distribute-lft-out--60.0%
distribute-rgt-out--73.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 98.5%
+-commutative98.5%
associate--r+98.5%
Simplified98.5%
Taylor expanded in d1 around inf 86.3%
neg-mul-186.3%
Simplified86.3%
if -5.69999999999999998e141 < d1 < 7.5999999999999993e88 or 8.20000000000000002e124 < d1 < 1.6000000000000001e179Initial program 96.3%
associate--l+96.3%
distribute-lft-out--96.3%
distribute-rgt-out--96.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 90.5%
Taylor expanded in d3 around 0 60.3%
Final simplification66.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.5e+91)
(* d1 (- d2 d3))
(if (or (<= d2 -4.7e-163) (not (<= d2 -2.6e-300)))
(* d1 (- d4 d3))
(* d1 (- d4 d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.5e+91) {
tmp = d1 * (d2 - d3);
} else if ((d2 <= -4.7e-163) || !(d2 <= -2.6e-300)) {
tmp = d1 * (d4 - d3);
} 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.5d+91)) then
tmp = d1 * (d2 - d3)
else if ((d2 <= (-4.7d-163)) .or. (.not. (d2 <= (-2.6d-300)))) then
tmp = d1 * (d4 - d3)
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.5e+91) {
tmp = d1 * (d2 - d3);
} else if ((d2 <= -4.7e-163) || !(d2 <= -2.6e-300)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.5e+91: tmp = d1 * (d2 - d3) elif (d2 <= -4.7e-163) or not (d2 <= -2.6e-300): tmp = d1 * (d4 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.5e+91) tmp = Float64(d1 * Float64(d2 - d3)); elseif ((d2 <= -4.7e-163) || !(d2 <= -2.6e-300)) tmp = Float64(d1 * Float64(d4 - d3)); 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.5e+91) tmp = d1 * (d2 - d3); elseif ((d2 <= -4.7e-163) || ~((d2 <= -2.6e-300))) tmp = d1 * (d4 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.5e+91], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d2, -4.7e-163], N[Not[LessEqual[d2, -2.6e-300]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.5 \cdot 10^{+91}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -4.7 \cdot 10^{-163} \lor \neg \left(d2 \leq -2.6 \cdot 10^{-300}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.50000000000000003e91Initial program 83.9%
associate--l+83.9%
distribute-lft-out--85.7%
distribute-rgt-out--91.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.7%
Taylor expanded in d4 around 0 77.4%
if -1.50000000000000003e91 < d2 < -4.7e-163 or -2.59999999999999997e-300 < d2 Initial program 86.0%
associate--l+86.0%
distribute-lft-out--86.5%
distribute-rgt-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 78.2%
Taylor expanded in d2 around 0 55.0%
if -4.7e-163 < d2 < -2.59999999999999997e-300Initial program 93.1%
associate--l+93.1%
distribute-lft-out--93.1%
distribute-rgt-out--96.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 99.9%
+-commutative99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in d3 around 0 73.8%
Final simplification62.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 7.6e-295)
t_0
(if (<= d4 4.5e-206)
(- (* d1 d1))
(if (<= d4 7e+57) t_0 (* d1 (+ d2 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 7.6e-295) {
tmp = t_0;
} else if (d4 <= 4.5e-206) {
tmp = -(d1 * d1);
} else if (d4 <= 7e+57) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 7.6d-295) then
tmp = t_0
else if (d4 <= 4.5d-206) then
tmp = -(d1 * d1)
else if (d4 <= 7d+57) then
tmp = t_0
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 7.6e-295) {
tmp = t_0;
} else if (d4 <= 4.5e-206) {
tmp = -(d1 * d1);
} else if (d4 <= 7e+57) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 7.6e-295: tmp = t_0 elif d4 <= 4.5e-206: tmp = -(d1 * d1) elif d4 <= 7e+57: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 7.6e-295) tmp = t_0; elseif (d4 <= 4.5e-206) tmp = Float64(-Float64(d1 * d1)); elseif (d4 <= 7e+57) tmp = t_0; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 7.6e-295) tmp = t_0; elseif (d4 <= 4.5e-206) tmp = -(d1 * d1); elseif (d4 <= 7e+57) tmp = t_0; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 7.6e-295], t$95$0, If[LessEqual[d4, 4.5e-206], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d4, 7e+57], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 7.6 \cdot 10^{-295}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 4.5 \cdot 10^{-206}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d4 \leq 7 \cdot 10^{+57}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 7.60000000000000037e-295 or 4.4999999999999998e-206 < d4 < 6.9999999999999995e57Initial program 85.4%
associate--l+85.4%
distribute-lft-out--85.9%
distribute-rgt-out--89.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 77.5%
Taylor expanded in d4 around 0 61.6%
if 7.60000000000000037e-295 < d4 < 4.4999999999999998e-206Initial program 94.1%
associate--l+94.1%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 71.3%
+-commutative71.3%
associate--r+71.3%
Simplified71.3%
Taylor expanded in d1 around inf 37.7%
neg-mul-137.7%
Simplified37.7%
if 6.9999999999999995e57 < d4 Initial program 87.0%
associate--l+87.0%
distribute-lft-out--87.0%
distribute-rgt-out--94.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 88.3%
Taylor expanded in d3 around 0 80.2%
Final simplification63.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -3.3e+36) (not (<= d1 3.8e+70))) (* d1 (- (- d4 d3) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -3.3e+36) || !(d1 <= 3.8e+70)) {
tmp = d1 * ((d4 - d3) - 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 <= (-3.3d+36)) .or. (.not. (d1 <= 3.8d+70))) then
tmp = d1 * ((d4 - d3) - 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 <= -3.3e+36) || !(d1 <= 3.8e+70)) {
tmp = d1 * ((d4 - d3) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -3.3e+36) or not (d1 <= 3.8e+70): tmp = d1 * ((d4 - d3) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -3.3e+36) || !(d1 <= 3.8e+70)) tmp = Float64(d1 * Float64(Float64(d4 - d3) - 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 <= -3.3e+36) || ~((d1 <= 3.8e+70))) tmp = d1 * ((d4 - d3) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -3.3e+36], N[Not[LessEqual[d1, 3.8e+70]], $MachinePrecision]], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -3.3 \cdot 10^{+36} \lor \neg \left(d1 \leq 3.8 \cdot 10^{+70}\right):\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -3.2999999999999999e36 or 3.7999999999999998e70 < d1 Initial program 69.6%
associate--l+69.6%
distribute-lft-out--71.4%
distribute-rgt-out--80.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 88.9%
+-commutative88.9%
associate--r+88.9%
Simplified88.9%
if -3.2999999999999999e36 < d1 < 3.7999999999999998e70Initial program 99.3%
associate--l+99.3%
distribute-lft-out--99.3%
distribute-rgt-out--99.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 96.7%
Final simplification93.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 -6.2e-276) (* d1 d2) (if (<= d4 1.7e+23) (- (* d1 d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -6.2e-276) {
tmp = d1 * d2;
} else if (d4 <= 1.7e+23) {
tmp = -(d1 * d1);
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= (-6.2d-276)) then
tmp = d1 * d2
else if (d4 <= 1.7d+23) then
tmp = -(d1 * d1)
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -6.2e-276) {
tmp = d1 * d2;
} else if (d4 <= 1.7e+23) {
tmp = -(d1 * d1);
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -6.2e-276: tmp = d1 * d2 elif d4 <= 1.7e+23: tmp = -(d1 * d1) else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -6.2e-276) tmp = Float64(d1 * d2); elseif (d4 <= 1.7e+23) 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 (d4 <= -6.2e-276) tmp = d1 * d2; elseif (d4 <= 1.7e+23) tmp = -(d1 * d1); else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -6.2e-276], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.7e+23], (-N[(d1 * d1), $MachinePrecision]), N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -6.2 \cdot 10^{-276}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.7 \cdot 10^{+23}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -6.19999999999999978e-276Initial program 82.7%
associate--l+82.7%
distribute-lft-out--82.7%
distribute-rgt-out--87.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.1%
if -6.19999999999999978e-276 < d4 < 1.69999999999999996e23Initial program 92.6%
associate--l+92.6%
distribute-lft-out--95.6%
distribute-rgt-out--95.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 68.6%
+-commutative68.6%
associate--r+68.6%
Simplified68.6%
Taylor expanded in d1 around inf 34.5%
neg-mul-134.5%
Simplified34.5%
if 1.69999999999999996e23 < d4 Initial program 86.9%
associate--l+86.9%
distribute-lft-out--86.9%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 52.2%
Final simplification36.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -5.4e-17) (* d1 (- d2 d3)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.4e-17) {
tmp = d1 * (d2 - d3);
} 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 <= (-5.4d-17)) then
tmp = d1 * (d2 - d3)
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 <= -5.4e-17) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -5.4e-17: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -5.4e-17) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -5.4e-17) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -5.4e-17], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -5.4 \cdot 10^{-17}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -5.4000000000000002e-17Initial program 80.7%
associate--l+80.7%
distribute-lft-out--82.1%
distribute-rgt-out--89.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 86.2%
Taylor expanded in d4 around 0 70.0%
if -5.4000000000000002e-17 < d2 Initial program 88.8%
associate--l+88.8%
distribute-lft-out--89.3%
distribute-rgt-out--91.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 79.8%
+-commutative79.8%
associate--r+79.8%
Simplified79.8%
Taylor expanded in d3 around 0 56.1%
Final simplification60.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -7e+88) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -7e+88) {
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 <= (-7d+88)) 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 <= -7e+88) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -7e+88: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -7e+88) 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 <= -7e+88) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -7e+88], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -7 \cdot 10^{+88}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -6.9999999999999995e88Initial program 84.2%
associate--l+84.2%
distribute-lft-out--86.0%
distribute-rgt-out--91.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 55.7%
if -6.9999999999999995e88 < d2 Initial program 86.9%
associate--l+86.9%
distribute-lft-out--87.4%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 29.1%
Final simplification35.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d2
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 86.3%
associate--l+86.3%
distribute-lft-out--87.1%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 32.7%
Final simplification32.7%
(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 2024053
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))