
(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 14 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--89.0%
distribute-lft-out100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 8.4e-293)
t_1
(if (<= d4 3.8e-135)
t_0
(if (<= d4 2e-42)
t_1
(if (<= d4 6.2e+21)
t_0
(if (or (<= d4 1.6e+103)
(and (not (<= d4 7.2e+174)) (<= d4 3e+252)))
(* d1 (- d4 d3))
(* d1 (- d4 d1)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 8.4e-293) {
tmp = t_1;
} else if (d4 <= 3.8e-135) {
tmp = t_0;
} else if (d4 <= 2e-42) {
tmp = t_1;
} else if (d4 <= 6.2e+21) {
tmp = t_0;
} else if ((d4 <= 1.6e+103) || (!(d4 <= 7.2e+174) && (d4 <= 3e+252))) {
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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= 8.4d-293) then
tmp = t_1
else if (d4 <= 3.8d-135) then
tmp = t_0
else if (d4 <= 2d-42) then
tmp = t_1
else if (d4 <= 6.2d+21) then
tmp = t_0
else if ((d4 <= 1.6d+103) .or. (.not. (d4 <= 7.2d+174)) .and. (d4 <= 3d+252)) 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 t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= 8.4e-293) {
tmp = t_1;
} else if (d4 <= 3.8e-135) {
tmp = t_0;
} else if (d4 <= 2e-42) {
tmp = t_1;
} else if (d4 <= 6.2e+21) {
tmp = t_0;
} else if ((d4 <= 1.6e+103) || (!(d4 <= 7.2e+174) && (d4 <= 3e+252))) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= 8.4e-293: tmp = t_1 elif d4 <= 3.8e-135: tmp = t_0 elif d4 <= 2e-42: tmp = t_1 elif d4 <= 6.2e+21: tmp = t_0 elif (d4 <= 1.6e+103) or (not (d4 <= 7.2e+174) and (d4 <= 3e+252)): tmp = d1 * (d4 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 8.4e-293) tmp = t_1; elseif (d4 <= 3.8e-135) tmp = t_0; elseif (d4 <= 2e-42) tmp = t_1; elseif (d4 <= 6.2e+21) tmp = t_0; elseif ((d4 <= 1.6e+103) || (!(d4 <= 7.2e+174) && (d4 <= 3e+252))) 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) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 8.4e-293) tmp = t_1; elseif (d4 <= 3.8e-135) tmp = t_0; elseif (d4 <= 2e-42) tmp = t_1; elseif (d4 <= 6.2e+21) tmp = t_0; elseif ((d4 <= 1.6e+103) || (~((d4 <= 7.2e+174)) && (d4 <= 3e+252))) tmp = d1 * (d4 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 8.4e-293], t$95$1, If[LessEqual[d4, 3.8e-135], t$95$0, If[LessEqual[d4, 2e-42], t$95$1, If[LessEqual[d4, 6.2e+21], t$95$0, If[Or[LessEqual[d4, 1.6e+103], And[N[Not[LessEqual[d4, 7.2e+174]], $MachinePrecision], LessEqual[d4, 3e+252]]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 8.4 \cdot 10^{-293}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 3.8 \cdot 10^{-135}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 6.2 \cdot 10^{+21}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.6 \cdot 10^{+103} \lor \neg \left(d4 \leq 7.2 \cdot 10^{+174}\right) \land d4 \leq 3 \cdot 10^{+252}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < 8.40000000000000021e-293 or 3.8000000000000003e-135 < d4 < 2.00000000000000008e-42Initial program 85.2%
associate--l+85.2%
distribute-lft-out--85.9%
distribute-rgt-out--87.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 81.7%
+-commutative81.7%
associate--r+81.7%
Simplified81.7%
Taylor expanded in d1 around 0 60.5%
if 8.40000000000000021e-293 < d4 < 3.8000000000000003e-135 or 2.00000000000000008e-42 < d4 < 6.2e21Initial program 90.2%
associate--l+90.2%
distribute-lft-out--92.2%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 98.2%
+-commutative98.2%
associate--r+98.2%
Simplified98.2%
Taylor expanded in d3 around 0 71.0%
if 6.2e21 < d4 < 1.59999999999999996e103 or 7.2000000000000003e174 < d4 < 2.99999999999999989e252Initial program 90.6%
associate--l+90.6%
distribute-lft-out--90.6%
distribute-rgt-out--93.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 81.5%
+-commutative81.5%
associate--r+81.5%
Simplified81.5%
Taylor expanded in d1 around 0 78.7%
if 1.59999999999999996e103 < d4 < 7.2000000000000003e174 or 2.99999999999999989e252 < d4 Initial program 79.2%
associate--l+79.2%
distribute-lft-out--79.2%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 92.0%
+-commutative92.0%
associate--r+92.0%
Simplified92.0%
Taylor expanded in d3 around 0 92.0%
Final simplification67.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 2.35e-293)
(* d1 (- d2 d3))
(if (<= d4 3.6e-229)
t_0
(if (<= d4 6.2e+27)
(* d1 (- (- d3) d1))
(if (or (<= d4 1e+105) (not (<= d4 7.5e+122)))
(* d1 (- d4 d3))
t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 2.35e-293) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3.6e-229) {
tmp = t_0;
} else if (d4 <= 6.2e+27) {
tmp = d1 * (-d3 - d1);
} else if ((d4 <= 1e+105) || !(d4 <= 7.5e+122)) {
tmp = d1 * (d4 - d3);
} 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) :: tmp
t_0 = d1 * (d2 - d1)
if (d4 <= 2.35d-293) then
tmp = d1 * (d2 - d3)
else if (d4 <= 3.6d-229) then
tmp = t_0
else if (d4 <= 6.2d+27) then
tmp = d1 * (-d3 - d1)
else if ((d4 <= 1d+105) .or. (.not. (d4 <= 7.5d+122))) then
tmp = d1 * (d4 - d3)
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 - d1);
double tmp;
if (d4 <= 2.35e-293) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3.6e-229) {
tmp = t_0;
} else if (d4 <= 6.2e+27) {
tmp = d1 * (-d3 - d1);
} else if ((d4 <= 1e+105) || !(d4 <= 7.5e+122)) {
tmp = d1 * (d4 - d3);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= 2.35e-293: tmp = d1 * (d2 - d3) elif d4 <= 3.6e-229: tmp = t_0 elif d4 <= 6.2e+27: tmp = d1 * (-d3 - d1) elif (d4 <= 1e+105) or not (d4 <= 7.5e+122): tmp = d1 * (d4 - d3) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= 2.35e-293) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 3.6e-229) tmp = t_0; elseif (d4 <= 6.2e+27) tmp = Float64(d1 * Float64(Float64(-d3) - d1)); elseif ((d4 <= 1e+105) || !(d4 <= 7.5e+122)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d4 <= 2.35e-293) tmp = d1 * (d2 - d3); elseif (d4 <= 3.6e-229) tmp = t_0; elseif (d4 <= 6.2e+27) tmp = d1 * (-d3 - d1); elseif ((d4 <= 1e+105) || ~((d4 <= 7.5e+122))) tmp = d1 * (d4 - d3); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 2.35e-293], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 3.6e-229], t$95$0, If[LessEqual[d4, 6.2e+27], N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d4, 1e+105], N[Not[LessEqual[d4, 7.5e+122]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq 2.35 \cdot 10^{-293}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 3.6 \cdot 10^{-229}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 6.2 \cdot 10^{+27}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{elif}\;d4 \leq 10^{+105} \lor \neg \left(d4 \leq 7.5 \cdot 10^{+122}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d4 < 2.35000000000000006e-293Initial program 85.6%
associate--l+85.6%
distribute-lft-out--86.3%
distribute-rgt-out--87.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 80.1%
+-commutative80.1%
associate--r+80.1%
Simplified80.1%
Taylor expanded in d1 around 0 58.4%
if 2.35000000000000006e-293 < d4 < 3.60000000000000003e-229 or 9.9999999999999994e104 < d4 < 7.5000000000000002e122Initial program 86.7%
associate--l+86.7%
distribute-lft-out--86.7%
distribute-rgt-out--86.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 96.4%
+-commutative96.4%
associate--r+96.4%
Simplified96.4%
Taylor expanded in d3 around 0 71.2%
if 3.60000000000000003e-229 < d4 < 6.19999999999999992e27Initial program 87.7%
associate--l+87.7%
distribute-lft-out--89.5%
distribute-rgt-out--89.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 96.7%
+-commutative96.7%
associate--r+96.7%
Simplified96.7%
Taylor expanded in d2 around 0 73.2%
mul-1-neg73.2%
*-commutative73.2%
distribute-rgt-neg-in73.2%
Simplified73.2%
if 6.19999999999999992e27 < d4 < 9.9999999999999994e104 or 7.5000000000000002e122 < d4 Initial program 86.5%
associate--l+86.5%
distribute-lft-out--86.5%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 86.8%
+-commutative86.8%
associate--r+86.8%
Simplified86.8%
Taylor expanded in d1 around 0 81.2%
Final simplification67.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))))
(if (<= d4 -2.1e-107)
(* d1 d2)
(if (<= d4 1e-293)
t_0
(if (<= d4 2.7e-227) (* d1 d2) (if (<= d4 1.65e+59) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d4 <= -2.1e-107) {
tmp = d1 * d2;
} else if (d4 <= 1e-293) {
tmp = t_0;
} else if (d4 <= 2.7e-227) {
tmp = d1 * d2;
} else if (d4 <= 1.65e+59) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * -d3
if (d4 <= (-2.1d-107)) then
tmp = d1 * d2
else if (d4 <= 1d-293) then
tmp = t_0
else if (d4 <= 2.7d-227) then
tmp = d1 * d2
else if (d4 <= 1.65d+59) 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 * -d3;
double tmp;
if (d4 <= -2.1e-107) {
tmp = d1 * d2;
} else if (d4 <= 1e-293) {
tmp = t_0;
} else if (d4 <= 2.7e-227) {
tmp = d1 * d2;
} else if (d4 <= 1.65e+59) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 tmp = 0 if d4 <= -2.1e-107: tmp = d1 * d2 elif d4 <= 1e-293: tmp = t_0 elif d4 <= 2.7e-227: tmp = d1 * d2 elif d4 <= 1.65e+59: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d4 <= -2.1e-107) tmp = Float64(d1 * d2); elseif (d4 <= 1e-293) tmp = t_0; elseif (d4 <= 2.7e-227) tmp = Float64(d1 * d2); elseif (d4 <= 1.65e+59) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; tmp = 0.0; if (d4 <= -2.1e-107) tmp = d1 * d2; elseif (d4 <= 1e-293) tmp = t_0; elseif (d4 <= 2.7e-227) tmp = d1 * d2; elseif (d4 <= 1.65e+59) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d4, -2.1e-107], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1e-293], t$95$0, If[LessEqual[d4, 2.7e-227], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.65e+59], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq -2.1 \cdot 10^{-107}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 10^{-293}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.7 \cdot 10^{-227}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.65 \cdot 10^{+59}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -2.0999999999999999e-107 or 1.0000000000000001e-293 < d4 < 2.7e-227Initial program 84.9%
associate--l+84.9%
distribute-lft-out--84.9%
distribute-rgt-out--87.0%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around inf 31.0%
if -2.0999999999999999e-107 < d4 < 1.0000000000000001e-293 or 2.7e-227 < d4 < 1.65e59Initial program 88.7%
associate--l+88.7%
distribute-lft-out--90.4%
distribute-rgt-out--90.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 45.7%
associate-*r*45.7%
neg-mul-145.7%
Simplified45.7%
if 1.65e59 < d4 Initial program 83.3%
associate--l+83.3%
distribute-lft-out--83.3%
distribute-rgt-out--89.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 73.8%
Final simplification45.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 3.8e-294)
t_0
(if (<= d4 3e-134)
(* d1 (- d2 d1))
(if (<= d4 1.8e-42) t_0 (* d1 (- d4 d1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 3.8e-294) {
tmp = t_0;
} else if (d4 <= 3e-134) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.8e-42) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d3)
if (d4 <= 3.8d-294) then
tmp = t_0
else if (d4 <= 3d-134) then
tmp = d1 * (d2 - d1)
else if (d4 <= 1.8d-42) then
tmp = t_0
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= 3.8e-294) {
tmp = t_0;
} else if (d4 <= 3e-134) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.8e-42) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= 3.8e-294: tmp = t_0 elif d4 <= 3e-134: tmp = d1 * (d2 - d1) elif d4 <= 1.8e-42: tmp = t_0 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= 3.8e-294) tmp = t_0; elseif (d4 <= 3e-134) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 1.8e-42) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= 3.8e-294) tmp = t_0; elseif (d4 <= 3e-134) tmp = d1 * (d2 - d1); elseif (d4 <= 1.8e-42) tmp = t_0; else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 3.8e-294], t$95$0, If[LessEqual[d4, 3e-134], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.8e-42], t$95$0, N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 3.8 \cdot 10^{-294}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 3 \cdot 10^{-134}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 1.8 \cdot 10^{-42}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < 3.8e-294 or 3e-134 < d4 < 1.8000000000000001e-42Initial program 85.2%
associate--l+85.2%
distribute-lft-out--85.9%
distribute-rgt-out--87.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 81.7%
+-commutative81.7%
associate--r+81.7%
Simplified81.7%
Taylor expanded in d1 around 0 60.5%
if 3.8e-294 < d4 < 3e-134Initial program 89.2%
associate--l+89.2%
distribute-lft-out--89.2%
distribute-rgt-out--89.2%
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 67.8%
if 1.8000000000000001e-42 < d4 Initial program 87.1%
associate--l+87.1%
distribute-lft-out--88.5%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 82.0%
+-commutative82.0%
associate--r+82.0%
Simplified82.0%
Taylor expanded in d3 around 0 72.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d1 -6.2e+126)
t_0
(if (<= d1 -5.6e-169)
(* d1 (- d2 d3))
(if (<= d1 4.9e-8) (* d1 (+ d2 d4)) t_0)))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d1 <= -6.2e+126) {
tmp = t_0;
} else if (d1 <= -5.6e-169) {
tmp = d1 * (d2 - d3);
} else if (d1 <= 4.9e-8) {
tmp = d1 * (d2 + d4);
} 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) :: tmp
t_0 = d1 * (d2 - d1)
if (d1 <= (-6.2d+126)) then
tmp = t_0
else if (d1 <= (-5.6d-169)) then
tmp = d1 * (d2 - d3)
else if (d1 <= 4.9d-8) then
tmp = d1 * (d2 + d4)
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 - d1);
double tmp;
if (d1 <= -6.2e+126) {
tmp = t_0;
} else if (d1 <= -5.6e-169) {
tmp = d1 * (d2 - d3);
} else if (d1 <= 4.9e-8) {
tmp = d1 * (d2 + d4);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d1 <= -6.2e+126: tmp = t_0 elif d1 <= -5.6e-169: tmp = d1 * (d2 - d3) elif d1 <= 4.9e-8: tmp = d1 * (d2 + d4) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d1 <= -6.2e+126) tmp = t_0; elseif (d1 <= -5.6e-169) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d1 <= 4.9e-8) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d1 <= -6.2e+126) tmp = t_0; elseif (d1 <= -5.6e-169) tmp = d1 * (d2 - d3); elseif (d1 <= 4.9e-8) tmp = d1 * (d2 + d4); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -6.2e+126], t$95$0, If[LessEqual[d1, -5.6e-169], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 4.9e-8], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d1 \leq -6.2 \cdot 10^{+126}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d1 \leq -5.6 \cdot 10^{-169}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d1 \leq 4.9 \cdot 10^{-8}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d1 < -6.2e126 or 4.9000000000000002e-8 < d1 Initial program 66.6%
associate--l+66.6%
distribute-lft-out--67.6%
distribute-rgt-out--72.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 92.6%
+-commutative92.6%
associate--r+92.6%
Simplified92.6%
Taylor expanded in d3 around 0 75.6%
if -6.2e126 < d1 < -5.59999999999999976e-169Initial program 98.3%
associate--l+98.3%
distribute-lft-out--99.9%
distribute-rgt-out--99.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.7%
+-commutative82.7%
associate--r+82.7%
Simplified82.7%
Taylor expanded in d1 around 0 71.2%
if -5.59999999999999976e-169 < d1 < 4.9000000000000002e-8Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out99.9%
Simplified99.9%
+-commutative99.9%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in d1 around 0 96.9%
Taylor expanded in d3 around 0 73.1%
+-commutative73.1%
Simplified73.1%
Final simplification73.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 2.4e-134)
t_0
(if (<= d4 2.85e-105)
(* d1 (- d3))
(if (<= d4 44000.0) t_0 (* d1 (+ d2 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 2.4e-134) {
tmp = t_0;
} else if (d4 <= 2.85e-105) {
tmp = d1 * -d3;
} else if (d4 <= 44000.0) {
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 - d1)
if (d4 <= 2.4d-134) then
tmp = t_0
else if (d4 <= 2.85d-105) then
tmp = d1 * -d3
else if (d4 <= 44000.0d0) 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 - d1);
double tmp;
if (d4 <= 2.4e-134) {
tmp = t_0;
} else if (d4 <= 2.85e-105) {
tmp = d1 * -d3;
} else if (d4 <= 44000.0) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= 2.4e-134: tmp = t_0 elif d4 <= 2.85e-105: tmp = d1 * -d3 elif d4 <= 44000.0: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= 2.4e-134) tmp = t_0; elseif (d4 <= 2.85e-105) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 44000.0) 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 - d1); tmp = 0.0; if (d4 <= 2.4e-134) tmp = t_0; elseif (d4 <= 2.85e-105) tmp = d1 * -d3; elseif (d4 <= 44000.0) 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 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 2.4e-134], t$95$0, If[LessEqual[d4, 2.85e-105], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 44000.0], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq 2.4 \cdot 10^{-134}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.85 \cdot 10^{-105}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 44000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 2.4000000000000001e-134 or 2.84999999999999981e-105 < d4 < 44000Initial program 85.8%
associate--l+85.8%
distribute-lft-out--86.9%
distribute-rgt-out--87.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.3%
+-commutative85.3%
associate--r+85.3%
Simplified85.3%
Taylor expanded in d3 around 0 58.1%
if 2.4000000000000001e-134 < d4 < 2.84999999999999981e-105Initial 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 d3 around inf 51.0%
associate-*r*51.0%
neg-mul-151.0%
Simplified51.0%
if 44000 < d4 Initial program 86.4%
associate--l+86.4%
distribute-lft-out--86.4%
distribute-rgt-out--91.5%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in91.5%
Applied egg-rr91.5%
Taylor expanded in d1 around 0 86.9%
Taylor expanded in d3 around 0 77.4%
+-commutative77.4%
Simplified77.4%
Final simplification62.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -2.1e+115) (not (<= d1 4600000000000.0))) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -2.1e+115) || !(d1 <= 4600000000000.0)) {
tmp = d1 * ((d2 - 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 <= (-2.1d+115)) .or. (.not. (d1 <= 4600000000000.0d0))) then
tmp = d1 * ((d2 - 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 <= -2.1e+115) || !(d1 <= 4600000000000.0)) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -2.1e+115) or not (d1 <= 4600000000000.0): tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -2.1e+115) || !(d1 <= 4600000000000.0)) tmp = Float64(d1 * Float64(Float64(d2 - 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 <= -2.1e+115) || ~((d1 <= 4600000000000.0))) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -2.1e+115], N[Not[LessEqual[d1, 4600000000000.0]], $MachinePrecision]], N[(d1 * N[(N[(d2 - 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 -2.1 \cdot 10^{+115} \lor \neg \left(d1 \leq 4600000000000\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -2.10000000000000003e115 or 4.6e12 < d1 Initial program 66.6%
associate--l+66.6%
distribute-lft-out--67.6%
distribute-rgt-out--72.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 92.3%
+-commutative92.3%
associate--r+92.3%
Simplified92.3%
if -2.10000000000000003e115 < d1 < 4.6e12Initial program 99.3%
associate--l+99.3%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in d1 around 0 93.3%
Final simplification92.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.8e+175) (not (<= d3 1.1e+112))) (* d1 (- d2 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.8e+175) || !(d3 <= 1.1e+112)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-1.8d+175)) .or. (.not. (d3 <= 1.1d+112))) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * ((d2 + d4) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.8e+175) || !(d3 <= 1.1e+112)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.8e+175) or not (d3 <= 1.1e+112): tmp = d1 * (d2 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.8e+175) || !(d3 <= 1.1e+112)) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.8e+175) || ~((d3 <= 1.1e+112))) tmp = d1 * (d2 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.8e+175], N[Not[LessEqual[d3, 1.1e+112]], $MachinePrecision]], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.8 \cdot 10^{+175} \lor \neg \left(d3 \leq 1.1 \cdot 10^{+112}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -1.80000000000000017e175 or 1.1e112 < d3 Initial program 83.3%
associate--l+83.3%
distribute-lft-out--86.3%
distribute-rgt-out--86.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 87.4%
+-commutative87.4%
associate--r+87.4%
Simplified87.4%
Taylor expanded in d1 around 0 84.4%
if -1.80000000000000017e175 < d3 < 1.1e112Initial program 87.3%
associate--l+87.3%
distribute-lft-out--87.3%
distribute-rgt-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.6%
Final simplification88.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -2.4e+175) (* d1 (- d2 d3)) (if (<= d3 4.2e+67) (* d1 (- (+ d2 d4) d1)) (* d1 (- (+ d2 d4) d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.4e+175) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 4.2e+67) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d3 <= (-2.4d+175)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 4.2d+67) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.4e+175) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 4.2e+67) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -2.4e+175: tmp = d1 * (d2 - d3) elif d3 <= 4.2e+67: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -2.4e+175) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 4.2e+67) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -2.4e+175) tmp = d1 * (d2 - d3); elseif (d3 <= 4.2e+67) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -2.4e+175], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 4.2e+67], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -2.4 \cdot 10^{+175}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 4.2 \cdot 10^{+67}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d3 < -2.4e175Initial program 76.7%
associate--l+76.7%
distribute-lft-out--83.3%
distribute-rgt-out--83.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 94.5%
+-commutative94.5%
associate--r+94.5%
Simplified94.5%
Taylor expanded in d1 around 0 91.1%
if -2.4e175 < d3 < 4.2000000000000003e67Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--90.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.3%
if 4.2000000000000003e67 < d3 Initial program 87.8%
associate--l+87.8%
distribute-lft-out--87.8%
distribute-rgt-out--87.8%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in87.8%
Applied egg-rr87.8%
Taylor expanded in d1 around 0 97.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -5.6e+107) (not (<= d3 1.46e+167))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -5.6e+107) || !(d3 <= 1.46e+167)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-5.6d+107)) .or. (.not. (d3 <= 1.46d+167))) then
tmp = d1 * -d3
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -5.6e+107) || !(d3 <= 1.46e+167)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -5.6e+107) or not (d3 <= 1.46e+167): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -5.6e+107) || !(d3 <= 1.46e+167)) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -5.6e+107) || ~((d3 <= 1.46e+167))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -5.6e+107], N[Not[LessEqual[d3, 1.46e+167]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -5.6 \cdot 10^{+107} \lor \neg \left(d3 \leq 1.46 \cdot 10^{+167}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -5.59999999999999969e107 or 1.46000000000000012e167 < d3 Initial program 79.1%
associate--l+79.1%
distribute-lft-out--81.9%
distribute-rgt-out--81.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 77.2%
associate-*r*77.2%
neg-mul-177.2%
Simplified77.2%
if -5.59999999999999969e107 < d3 < 1.46000000000000012e167Initial program 89.1%
associate--l+89.1%
distribute-lft-out--89.1%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in91.8%
Applied egg-rr91.8%
Taylor expanded in d1 around 0 72.1%
Taylor expanded in d3 around 0 62.3%
+-commutative62.3%
Simplified62.3%
Final simplification66.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.65e+19) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.65e+19) {
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 <= 1.65d+19) 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 <= 1.65e+19) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.65e+19: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.65e+19) 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 <= 1.65e+19) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.65e+19], 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 1.65 \cdot 10^{+19}:\\
\;\;\;\;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 < 1.65e19Initial program 86.4%
associate--l+86.4%
distribute-lft-out--87.4%
distribute-rgt-out--88.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.8%
+-commutative85.8%
associate--r+85.8%
Simplified85.8%
if 1.65e19 < d4 Initial program 85.9%
associate--l+85.9%
distribute-lft-out--85.9%
distribute-rgt-out--91.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 86.2%
+-commutative86.2%
associate--r+86.2%
Simplified86.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 8.5e+20) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.5e+20) {
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 <= 8.5d+20) 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 <= 8.5e+20) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 8.5e+20: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 8.5e+20) 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 <= 8.5e+20) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 8.5e+20], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 8.5 \cdot 10^{+20}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 8.5e20Initial program 86.4%
associate--l+86.4%
distribute-lft-out--87.4%
distribute-rgt-out--88.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.5%
if 8.5e20 < d4 Initial program 85.9%
associate--l+85.9%
distribute-lft-out--85.9%
distribute-rgt-out--91.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 66.3%
(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--89.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 28.9%
(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 2024087
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))