
(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 (- d2 d3)) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 + (d2 - d3)) - 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 * ((d4 + (d2 - d3)) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 + (d2 - d3)) - d1);
}
def code(d1, d2, d3, d4): return d1 * ((d4 + (d2 - d3)) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d4 + Float64(d2 - d3)) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d4 + (d2 - d3)) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d4 + N[(d2 - d3), $MachinePrecision]), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d4 + \left(d2 - d3\right)\right) - d1\right)
\end{array}
Initial program 86.7%
+-commutative86.7%
*-commutative86.7%
distribute-lft-out--87.5%
distribute-lft-out90.2%
distribute-lft-out--100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -1.55e-195)
t_0
(if (<= d4 8.4e-303)
t_1
(if (<= d4 1.7e-147)
t_0
(if (or (<= d4 3.9e+68) (and (not (<= d4 4.2e+90)) (<= d4 1.45e+108)))
t_1
(* 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 <= -1.55e-195) {
tmp = t_0;
} else if (d4 <= 8.4e-303) {
tmp = t_1;
} else if (d4 <= 1.7e-147) {
tmp = t_0;
} else if ((d4 <= 3.9e+68) || (!(d4 <= 4.2e+90) && (d4 <= 1.45e+108))) {
tmp = t_1;
} 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 <= (-1.55d-195)) then
tmp = t_0
else if (d4 <= 8.4d-303) then
tmp = t_1
else if (d4 <= 1.7d-147) then
tmp = t_0
else if ((d4 <= 3.9d+68) .or. (.not. (d4 <= 4.2d+90)) .and. (d4 <= 1.45d+108)) then
tmp = t_1
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 <= -1.55e-195) {
tmp = t_0;
} else if (d4 <= 8.4e-303) {
tmp = t_1;
} else if (d4 <= 1.7e-147) {
tmp = t_0;
} else if ((d4 <= 3.9e+68) || (!(d4 <= 4.2e+90) && (d4 <= 1.45e+108))) {
tmp = t_1;
} 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 <= -1.55e-195: tmp = t_0 elif d4 <= 8.4e-303: tmp = t_1 elif d4 <= 1.7e-147: tmp = t_0 elif (d4 <= 3.9e+68) or (not (d4 <= 4.2e+90) and (d4 <= 1.45e+108)): tmp = t_1 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 <= -1.55e-195) tmp = t_0; elseif (d4 <= 8.4e-303) tmp = t_1; elseif (d4 <= 1.7e-147) tmp = t_0; elseif ((d4 <= 3.9e+68) || (!(d4 <= 4.2e+90) && (d4 <= 1.45e+108))) tmp = t_1; 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 <= -1.55e-195) tmp = t_0; elseif (d4 <= 8.4e-303) tmp = t_1; elseif (d4 <= 1.7e-147) tmp = t_0; elseif ((d4 <= 3.9e+68) || (~((d4 <= 4.2e+90)) && (d4 <= 1.45e+108))) tmp = t_1; 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, -1.55e-195], t$95$0, If[LessEqual[d4, 8.4e-303], t$95$1, If[LessEqual[d4, 1.7e-147], t$95$0, If[Or[LessEqual[d4, 3.9e+68], And[N[Not[LessEqual[d4, 4.2e+90]], $MachinePrecision], LessEqual[d4, 1.45e+108]]], t$95$1, 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 -1.55 \cdot 10^{-195}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 8.4 \cdot 10^{-303}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.7 \cdot 10^{-147}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 3.9 \cdot 10^{+68} \lor \neg \left(d4 \leq 4.2 \cdot 10^{+90}\right) \land d4 \leq 1.45 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < -1.55000000000000001e-195 or 8.4e-303 < d4 < 1.69999999999999998e-147Initial program 85.7%
Taylor expanded in d3 around 0 66.5%
distribute-lft-out69.5%
Simplified69.5%
Taylor expanded in d4 around 0 54.8%
unpow254.8%
distribute-lft-out--57.0%
Simplified57.0%
if -1.55000000000000001e-195 < d4 < 8.4e-303 or 1.69999999999999998e-147 < d4 < 3.90000000000000019e68 or 4.19999999999999961e90 < d4 < 1.45000000000000004e108Initial program 93.2%
+-commutative93.2%
*-commutative93.2%
distribute-lft-out--95.9%
distribute-lft-out95.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 84.2%
Taylor expanded in d4 around 0 75.8%
if 3.90000000000000019e68 < d4 < 4.19999999999999961e90 or 1.45000000000000004e108 < d4 Initial program 79.6%
+-commutative79.6%
*-commutative79.6%
distribute-lft-out--79.6%
distribute-lft-out81.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 94.4%
+-commutative94.4%
associate--r+94.4%
Simplified94.4%
Taylor expanded in d3 around 0 84.3%
Final simplification67.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -1.3e-194)
t_0
(if (<= d4 2.6e-299)
t_1
(if (<= d4 2.5e-147)
t_0
(if (<= d4 4.15e+65)
t_1
(if (<= d4 7e+90)
t_0
(if (<= d4 1.5e+108) t_1 (* d1 (+ d4 d2))))))))))
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 <= -1.3e-194) {
tmp = t_0;
} else if (d4 <= 2.6e-299) {
tmp = t_1;
} else if (d4 <= 2.5e-147) {
tmp = t_0;
} else if (d4 <= 4.15e+65) {
tmp = t_1;
} else if (d4 <= 7e+90) {
tmp = t_0;
} else if (d4 <= 1.5e+108) {
tmp = t_1;
} 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= (-1.3d-194)) then
tmp = t_0
else if (d4 <= 2.6d-299) then
tmp = t_1
else if (d4 <= 2.5d-147) then
tmp = t_0
else if (d4 <= 4.15d+65) then
tmp = t_1
else if (d4 <= 7d+90) then
tmp = t_0
else if (d4 <= 1.5d+108) then
tmp = t_1
else
tmp = d1 * (d4 + d2)
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 <= -1.3e-194) {
tmp = t_0;
} else if (d4 <= 2.6e-299) {
tmp = t_1;
} else if (d4 <= 2.5e-147) {
tmp = t_0;
} else if (d4 <= 4.15e+65) {
tmp = t_1;
} else if (d4 <= 7e+90) {
tmp = t_0;
} else if (d4 <= 1.5e+108) {
tmp = t_1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -1.3e-194: tmp = t_0 elif d4 <= 2.6e-299: tmp = t_1 elif d4 <= 2.5e-147: tmp = t_0 elif d4 <= 4.15e+65: tmp = t_1 elif d4 <= 7e+90: tmp = t_0 elif d4 <= 1.5e+108: tmp = t_1 else: tmp = d1 * (d4 + d2) 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 <= -1.3e-194) tmp = t_0; elseif (d4 <= 2.6e-299) tmp = t_1; elseif (d4 <= 2.5e-147) tmp = t_0; elseif (d4 <= 4.15e+65) tmp = t_1; elseif (d4 <= 7e+90) tmp = t_0; elseif (d4 <= 1.5e+108) tmp = t_1; else tmp = Float64(d1 * Float64(d4 + d2)); 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 <= -1.3e-194) tmp = t_0; elseif (d4 <= 2.6e-299) tmp = t_1; elseif (d4 <= 2.5e-147) tmp = t_0; elseif (d4 <= 4.15e+65) tmp = t_1; elseif (d4 <= 7e+90) tmp = t_0; elseif (d4 <= 1.5e+108) tmp = t_1; else tmp = d1 * (d4 + d2); 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, -1.3e-194], t$95$0, If[LessEqual[d4, 2.6e-299], t$95$1, If[LessEqual[d4, 2.5e-147], t$95$0, If[LessEqual[d4, 4.15e+65], t$95$1, If[LessEqual[d4, 7e+90], t$95$0, If[LessEqual[d4, 1.5e+108], t$95$1, N[(d1 * N[(d4 + d2), $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 -1.3 \cdot 10^{-194}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.6 \cdot 10^{-299}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 2.5 \cdot 10^{-147}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 4.15 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 7 \cdot 10^{+90}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.5 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < -1.30000000000000001e-194 or 2.5999999999999999e-299 < d4 < 2.50000000000000007e-147 or 4.1500000000000002e65 < d4 < 6.9999999999999997e90Initial program 85.4%
Taylor expanded in d3 around 0 68.2%
distribute-lft-out71.1%
Simplified71.1%
Taylor expanded in d4 around 0 56.8%
unpow256.8%
distribute-lft-out--59.0%
Simplified59.0%
if -1.30000000000000001e-194 < d4 < 2.5999999999999999e-299 or 2.50000000000000007e-147 < d4 < 4.1500000000000002e65 or 6.9999999999999997e90 < d4 < 1.49999999999999992e108Initial program 93.3%
+-commutative93.3%
*-commutative93.3%
distribute-lft-out--96.0%
distribute-lft-out96.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 84.4%
Taylor expanded in d4 around 0 76.1%
if 1.49999999999999992e108 < d4 Initial program 79.5%
+-commutative79.5%
*-commutative79.5%
distribute-lft-out--79.5%
distribute-lft-out79.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 90.9%
Taylor expanded in d3 around 0 79.8%
Final simplification67.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -7.5e-194)
t_0
(if (<= d4 1.4e-305)
t_1
(if (<= d4 2.2e-147) t_0 (if (<= d4 2e+26) t_1 (* d1 (- d4 d3))))))))
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 <= -7.5e-194) {
tmp = t_0;
} else if (d4 <= 1.4e-305) {
tmp = t_1;
} else if (d4 <= 2.2e-147) {
tmp = t_0;
} else if (d4 <= 2e+26) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= (-7.5d-194)) then
tmp = t_0
else if (d4 <= 1.4d-305) then
tmp = t_1
else if (d4 <= 2.2d-147) then
tmp = t_0
else if (d4 <= 2d+26) then
tmp = t_1
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 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -7.5e-194) {
tmp = t_0;
} else if (d4 <= 1.4e-305) {
tmp = t_1;
} else if (d4 <= 2.2e-147) {
tmp = t_0;
} else if (d4 <= 2e+26) {
tmp = t_1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -7.5e-194: tmp = t_0 elif d4 <= 1.4e-305: tmp = t_1 elif d4 <= 2.2e-147: tmp = t_0 elif d4 <= 2e+26: tmp = t_1 else: tmp = d1 * (d4 - d3) 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 <= -7.5e-194) tmp = t_0; elseif (d4 <= 1.4e-305) tmp = t_1; elseif (d4 <= 2.2e-147) tmp = t_0; elseif (d4 <= 2e+26) tmp = t_1; else tmp = Float64(d1 * Float64(d4 - d3)); 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 <= -7.5e-194) tmp = t_0; elseif (d4 <= 1.4e-305) tmp = t_1; elseif (d4 <= 2.2e-147) tmp = t_0; elseif (d4 <= 2e+26) tmp = t_1; else tmp = d1 * (d4 - d3); 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, -7.5e-194], t$95$0, If[LessEqual[d4, 1.4e-305], t$95$1, If[LessEqual[d4, 2.2e-147], t$95$0, If[LessEqual[d4, 2e+26], t$95$1, N[(d1 * N[(d4 - d3), $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 -7.5 \cdot 10^{-194}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.4 \cdot 10^{-305}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 2.2 \cdot 10^{-147}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2 \cdot 10^{+26}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < -7.4999999999999998e-194 or 1.40000000000000007e-305 < d4 < 2.2000000000000001e-147Initial program 85.7%
Taylor expanded in d3 around 0 66.5%
distribute-lft-out69.5%
Simplified69.5%
Taylor expanded in d4 around 0 54.8%
unpow254.8%
distribute-lft-out--57.0%
Simplified57.0%
if -7.4999999999999998e-194 < d4 < 1.40000000000000007e-305 or 2.2000000000000001e-147 < d4 < 2.0000000000000001e26Initial program 91.9%
+-commutative91.9%
*-commutative91.9%
distribute-lft-out--95.2%
distribute-lft-out95.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.8%
Taylor expanded in d4 around 0 78.9%
if 2.0000000000000001e26 < d4 Initial program 83.6%
+-commutative83.6%
*-commutative83.6%
distribute-lft-out--83.6%
distribute-lft-out85.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 88.8%
Taylor expanded in d4 around 0 85.5%
Taylor expanded in d2 around 0 78.0%
+-commutative78.0%
mul-1-neg78.0%
unsub-neg78.0%
distribute-lft-out--79.6%
Simplified79.6%
Final simplification67.7%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d4 -1.4e-194)
(* d1 (- d2 d1))
(if (<= d4 -3.8e-293)
t_0
(if (<= d4 1.7e-35)
(* d1 (- (- d1) d3))
(if (<= d4 4.4e+24) t_0 (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d4 <= -1.4e-194) {
tmp = d1 * (d2 - d1);
} else if (d4 <= -3.8e-293) {
tmp = t_0;
} else if (d4 <= 1.7e-35) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 4.4e+24) {
tmp = t_0;
} 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.4d-194)) then
tmp = d1 * (d2 - d1)
else if (d4 <= (-3.8d-293)) then
tmp = t_0
else if (d4 <= 1.7d-35) then
tmp = d1 * (-d1 - d3)
else if (d4 <= 4.4d+24) then
tmp = t_0
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.4e-194) {
tmp = d1 * (d2 - d1);
} else if (d4 <= -3.8e-293) {
tmp = t_0;
} else if (d4 <= 1.7e-35) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 4.4e+24) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d4 <= -1.4e-194: tmp = d1 * (d2 - d1) elif d4 <= -3.8e-293: tmp = t_0 elif d4 <= 1.7e-35: tmp = d1 * (-d1 - d3) elif d4 <= 4.4e+24: tmp = t_0 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.4e-194) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= -3.8e-293) tmp = t_0; elseif (d4 <= 1.7e-35) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d4 <= 4.4e+24) tmp = t_0; 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.4e-194) tmp = d1 * (d2 - d1); elseif (d4 <= -3.8e-293) tmp = t_0; elseif (d4 <= 1.7e-35) tmp = d1 * (-d1 - d3); elseif (d4 <= 4.4e+24) tmp = t_0; 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.4e-194], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, -3.8e-293], t$95$0, If[LessEqual[d4, 1.7e-35], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 4.4e+24], t$95$0, 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.4 \cdot 10^{-194}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq -3.8 \cdot 10^{-293}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.7 \cdot 10^{-35}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d4 \leq 4.4 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < -1.40000000000000006e-194Initial program 83.3%
Taylor expanded in d3 around 0 68.5%
distribute-lft-out72.5%
Simplified72.5%
Taylor expanded in d4 around 0 53.2%
unpow253.2%
distribute-lft-out--56.2%
Simplified56.2%
if -1.40000000000000006e-194 < d4 < -3.8e-293 or 1.7000000000000001e-35 < d4 < 4.40000000000000003e24Initial program 94.3%
+-commutative94.3%
*-commutative94.3%
distribute-lft-out--94.3%
distribute-lft-out94.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 88.9%
Taylor expanded in d4 around 0 84.4%
if -3.8e-293 < d4 < 1.7000000000000001e-35Initial program 91.4%
+-commutative91.4%
*-commutative91.4%
distribute-lft-out--94.8%
distribute-lft-out94.8%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d2 around 0 75.3%
+-commutative75.3%
associate--r+75.3%
Simplified75.3%
Taylor expanded in d4 around 0 75.0%
associate-*r*75.0%
mul-1-neg75.0%
Simplified75.0%
if 4.40000000000000003e24 < d4 Initial program 83.6%
+-commutative83.6%
*-commutative83.6%
distribute-lft-out--83.6%
distribute-lft-out85.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 88.8%
Taylor expanded in d4 around 0 85.5%
Taylor expanded in d2 around 0 78.0%
+-commutative78.0%
mul-1-neg78.0%
unsub-neg78.0%
distribute-lft-out--79.6%
Simplified79.6%
Final simplification69.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d3 (- d1))))
(if (<= d4 -5.2e-212)
(* d1 d2)
(if (<= d4 9e-14)
t_0
(if (<= d4 2.65e+23) (* d1 d2) (if (<= d4 8.5e+107) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d3 * -d1;
double tmp;
if (d4 <= -5.2e-212) {
tmp = d1 * d2;
} else if (d4 <= 9e-14) {
tmp = t_0;
} else if (d4 <= 2.65e+23) {
tmp = d1 * d2;
} else if (d4 <= 8.5e+107) {
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 = d3 * -d1
if (d4 <= (-5.2d-212)) then
tmp = d1 * d2
else if (d4 <= 9d-14) then
tmp = t_0
else if (d4 <= 2.65d+23) then
tmp = d1 * d2
else if (d4 <= 8.5d+107) 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 = d3 * -d1;
double tmp;
if (d4 <= -5.2e-212) {
tmp = d1 * d2;
} else if (d4 <= 9e-14) {
tmp = t_0;
} else if (d4 <= 2.65e+23) {
tmp = d1 * d2;
} else if (d4 <= 8.5e+107) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d3 * -d1 tmp = 0 if d4 <= -5.2e-212: tmp = d1 * d2 elif d4 <= 9e-14: tmp = t_0 elif d4 <= 2.65e+23: tmp = d1 * d2 elif d4 <= 8.5e+107: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d3 * Float64(-d1)) tmp = 0.0 if (d4 <= -5.2e-212) tmp = Float64(d1 * d2); elseif (d4 <= 9e-14) tmp = t_0; elseif (d4 <= 2.65e+23) tmp = Float64(d1 * d2); elseif (d4 <= 8.5e+107) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d3 * -d1; tmp = 0.0; if (d4 <= -5.2e-212) tmp = d1 * d2; elseif (d4 <= 9e-14) tmp = t_0; elseif (d4 <= 2.65e+23) tmp = d1 * d2; elseif (d4 <= 8.5e+107) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d3 * (-d1)), $MachinePrecision]}, If[LessEqual[d4, -5.2e-212], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 9e-14], t$95$0, If[LessEqual[d4, 2.65e+23], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 8.5e+107], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d3 \cdot \left(-d1\right)\\
\mathbf{if}\;d4 \leq -5.2 \cdot 10^{-212}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 9 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.65 \cdot 10^{+23}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 8.5 \cdot 10^{+107}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -5.2e-212 or 8.9999999999999995e-14 < d4 < 2.6500000000000001e23Initial program 84.2%
+-commutative84.2%
*-commutative84.2%
distribute-lft-out--84.2%
distribute-lft-out89.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 38.4%
if -5.2e-212 < d4 < 8.9999999999999995e-14 or 2.6500000000000001e23 < d4 < 8.4999999999999999e107Initial program 92.9%
+-commutative92.9%
*-commutative92.9%
distribute-lft-out--94.9%
distribute-lft-out95.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 44.0%
associate-*r*44.0%
neg-mul-144.0%
Simplified44.0%
if 8.4999999999999999e107 < d4 Initial program 79.5%
+-commutative79.5%
*-commutative79.5%
distribute-lft-out--79.5%
distribute-lft-out79.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 71.3%
Final simplification46.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 1.3e-73)
t_0
(if (<= d4 4.4e-45)
(* d3 (- d1))
(if (<= d4 5.6e+104) t_0 (* d1 (+ d4 d2)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 1.3e-73) {
tmp = t_0;
} else if (d4 <= 4.4e-45) {
tmp = d3 * -d1;
} else if (d4 <= 5.6e+104) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d1)
if (d4 <= 1.3d-73) then
tmp = t_0
else if (d4 <= 4.4d-45) then
tmp = d3 * -d1
else if (d4 <= 5.6d+104) then
tmp = t_0
else
tmp = d1 * (d4 + d2)
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 <= 1.3e-73) {
tmp = t_0;
} else if (d4 <= 4.4e-45) {
tmp = d3 * -d1;
} else if (d4 <= 5.6e+104) {
tmp = t_0;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= 1.3e-73: tmp = t_0 elif d4 <= 4.4e-45: tmp = d3 * -d1 elif d4 <= 5.6e+104: tmp = t_0 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= 1.3e-73) tmp = t_0; elseif (d4 <= 4.4e-45) tmp = Float64(d3 * Float64(-d1)); elseif (d4 <= 5.6e+104) tmp = t_0; else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d4 <= 1.3e-73) tmp = t_0; elseif (d4 <= 4.4e-45) tmp = d3 * -d1; elseif (d4 <= 5.6e+104) tmp = t_0; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 1.3e-73], t$95$0, If[LessEqual[d4, 4.4e-45], N[(d3 * (-d1)), $MachinePrecision], If[LessEqual[d4, 5.6e+104], t$95$0, N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq 1.3 \cdot 10^{-73}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 4.4 \cdot 10^{-45}:\\
\;\;\;\;d3 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 5.6 \cdot 10^{+104}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 1.3e-73 or 4.39999999999999987e-45 < d4 < 5.6e104Initial program 87.7%
Taylor expanded in d3 around 0 67.5%
distribute-lft-out69.4%
Simplified69.4%
Taylor expanded in d4 around 0 57.9%
unpow257.9%
distribute-lft-out--60.8%
Simplified60.8%
if 1.3e-73 < d4 < 4.39999999999999987e-45Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
distribute-lft-out--100.0%
distribute-lft-out100.0%
distribute-lft-out--99.8%
Simplified99.8%
Taylor expanded in d3 around inf 72.3%
associate-*r*72.3%
neg-mul-172.3%
Simplified72.3%
if 5.6e104 < d4 Initial program 80.4%
+-commutative80.4%
*-commutative80.4%
distribute-lft-out--80.4%
distribute-lft-out80.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 91.3%
Taylor expanded in d3 around 0 78.6%
Final simplification64.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -2e+188) (not (<= d3 9e+74))) (* d1 (- d4 d3)) (* d1 (- (+ d4 d2) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2e+188) || !(d3 <= 9e+74)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-2d+188)) .or. (.not. (d3 <= 9d+74))) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * ((d4 + d2) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2e+188) || !(d3 <= 9e+74)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d4 + d2) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -2e+188) or not (d3 <= 9e+74): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d4 + d2) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -2e+188) || !(d3 <= 9e+74)) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -2e+188) || ~((d3 <= 9e+74))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d4 + d2) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -2e+188], N[Not[LessEqual[d3, 9e+74]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -2 \cdot 10^{+188} \lor \neg \left(d3 \leq 9 \cdot 10^{+74}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -2e188 or 8.9999999999999999e74 < d3 Initial program 91.5%
+-commutative91.5%
*-commutative91.5%
distribute-lft-out--92.9%
distribute-lft-out95.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 97.3%
Taylor expanded in d4 around 0 93.1%
Taylor expanded in d2 around 0 79.9%
+-commutative79.9%
mul-1-neg79.9%
unsub-neg79.9%
distribute-lft-out--81.3%
Simplified81.3%
if -2e188 < d3 < 8.9999999999999999e74Initial program 84.9%
+-commutative84.9%
*-commutative84.9%
distribute-lft-out--85.4%
distribute-lft-out88.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.1%
Final simplification88.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -1.15e+71) (not (<= d1 1.7e+23))) (* d1 (- (+ d4 d2) d1)) (* d1 (- (+ d4 d2) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1.15e+71) || !(d1 <= 1.7e+23)) {
tmp = d1 * ((d4 + d2) - d1);
} else {
tmp = d1 * ((d4 + 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 ((d1 <= (-1.15d+71)) .or. (.not. (d1 <= 1.7d+23))) then
tmp = d1 * ((d4 + d2) - d1)
else
tmp = d1 * ((d4 + d2) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1.15e+71) || !(d1 <= 1.7e+23)) {
tmp = d1 * ((d4 + d2) - d1);
} else {
tmp = d1 * ((d4 + d2) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -1.15e+71) or not (d1 <= 1.7e+23): tmp = d1 * ((d4 + d2) - d1) else: tmp = d1 * ((d4 + d2) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -1.15e+71) || !(d1 <= 1.7e+23)) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d1)); else tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -1.15e+71) || ~((d1 <= 1.7e+23))) tmp = d1 * ((d4 + d2) - d1); else tmp = d1 * ((d4 + d2) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -1.15e+71], N[Not[LessEqual[d1, 1.7e+23]], $MachinePrecision]], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -1.15 \cdot 10^{+71} \lor \neg \left(d1 \leq 1.7 \cdot 10^{+23}\right):\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\end{array}
\end{array}
if d1 < -1.1500000000000001e71 or 1.69999999999999996e23 < d1 Initial program 68.5%
+-commutative68.5%
*-commutative68.5%
distribute-lft-out--70.4%
distribute-lft-out76.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.0%
if -1.1500000000000001e71 < d1 < 1.69999999999999996e23Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
distribute-lft-out--100.0%
distribute-lft-out100.0%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d1 around 0 98.1%
Final simplification96.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.85e+188) (not (<= d3 8e+98))) (* d3 (- d1)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.85e+188) || !(d3 <= 8e+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 <= (-1.85d+188)) .or. (.not. (d3 <= 8d+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 <= -1.85e+188) || !(d3 <= 8e+98)) {
tmp = d3 * -d1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.85e+188) or not (d3 <= 8e+98): tmp = d3 * -d1 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.85e+188) || !(d3 <= 8e+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 <= -1.85e+188) || ~((d3 <= 8e+98))) tmp = d3 * -d1; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.85e+188], N[Not[LessEqual[d3, 8e+98]], $MachinePrecision]], N[(d3 * (-d1)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.85 \cdot 10^{+188} \lor \neg \left(d3 \leq 8 \cdot 10^{+98}\right):\\
\;\;\;\;d3 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d3 < -1.85e188 or 7.99999999999999998e98 < d3 Initial program 89.6%
+-commutative89.6%
*-commutative89.6%
distribute-lft-out--91.0%
distribute-lft-out94.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 81.3%
associate-*r*81.3%
neg-mul-181.3%
Simplified81.3%
if -1.85e188 < d3 < 7.99999999999999998e98Initial program 85.7%
+-commutative85.7%
*-commutative85.7%
distribute-lft-out--86.2%
distribute-lft-out88.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 76.7%
Taylor expanded in d3 around 0 67.5%
Final simplification71.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 4.8e+37) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.8e+37) {
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 <= 4.8d+37) 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 <= 4.8e+37) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 4.8e+37: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 4.8e+37) 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 <= 4.8e+37) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 4.8e+37], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 4.8 \cdot 10^{+37}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 4.8e37Initial program 87.7%
+-commutative87.7%
*-commutative87.7%
distribute-lft-out--88.8%
distribute-lft-out91.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 37.4%
if 4.8e37 < d4 Initial program 83.3%
+-commutative83.3%
*-commutative83.3%
distribute-lft-out--83.3%
distribute-lft-out85.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 62.9%
Final simplification43.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.7%
+-commutative86.7%
*-commutative86.7%
distribute-lft-out--87.5%
distribute-lft-out90.2%
distribute-lft-out--100.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 2024079
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))