
(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 85.5%
associate--l+85.5%
distribute-lft-out--87.1%
distribute-rgt-out--90.6%
distribute-lft-out100.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 -5.4e-247)
t_1
(if (<= d4 -4.3e-300)
t_0
(if (<= d4 1.45e-248)
t_1
(if (<= d4 1.1e-189)
t_0
(if (<= d4 2.15e-102)
t_1
(if (<= d4 6.2e+67) t_0 (* d1 (+ d2 d4))))))))))
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 <= -5.4e-247) {
tmp = t_1;
} else if (d4 <= -4.3e-300) {
tmp = t_0;
} else if (d4 <= 1.45e-248) {
tmp = t_1;
} else if (d4 <= 1.1e-189) {
tmp = t_0;
} else if (d4 <= 2.15e-102) {
tmp = t_1;
} else if (d4 <= 6.2e+67) {
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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= (-5.4d-247)) then
tmp = t_1
else if (d4 <= (-4.3d-300)) then
tmp = t_0
else if (d4 <= 1.45d-248) then
tmp = t_1
else if (d4 <= 1.1d-189) then
tmp = t_0
else if (d4 <= 2.15d-102) then
tmp = t_1
else if (d4 <= 6.2d+67) 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 t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -5.4e-247) {
tmp = t_1;
} else if (d4 <= -4.3e-300) {
tmp = t_0;
} else if (d4 <= 1.45e-248) {
tmp = t_1;
} else if (d4 <= 1.1e-189) {
tmp = t_0;
} else if (d4 <= 2.15e-102) {
tmp = t_1;
} else if (d4 <= 6.2e+67) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -5.4e-247: tmp = t_1 elif d4 <= -4.3e-300: tmp = t_0 elif d4 <= 1.45e-248: tmp = t_1 elif d4 <= 1.1e-189: tmp = t_0 elif d4 <= 2.15e-102: tmp = t_1 elif d4 <= 6.2e+67: tmp = t_0 else: tmp = d1 * (d2 + d4) 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 <= -5.4e-247) tmp = t_1; elseif (d4 <= -4.3e-300) tmp = t_0; elseif (d4 <= 1.45e-248) tmp = t_1; elseif (d4 <= 1.1e-189) tmp = t_0; elseif (d4 <= 2.15e-102) tmp = t_1; elseif (d4 <= 6.2e+67) 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); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= -5.4e-247) tmp = t_1; elseif (d4 <= -4.3e-300) tmp = t_0; elseif (d4 <= 1.45e-248) tmp = t_1; elseif (d4 <= 1.1e-189) tmp = t_0; elseif (d4 <= 2.15e-102) tmp = t_1; elseif (d4 <= 6.2e+67) 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]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, -5.4e-247], t$95$1, If[LessEqual[d4, -4.3e-300], t$95$0, If[LessEqual[d4, 1.45e-248], t$95$1, If[LessEqual[d4, 1.1e-189], t$95$0, If[LessEqual[d4, 2.15e-102], t$95$1, If[LessEqual[d4, 6.2e+67], t$95$0, N[(d1 * N[(d2 + d4), $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 -5.4 \cdot 10^{-247}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq -4.3 \cdot 10^{-300}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.45 \cdot 10^{-248}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.1 \cdot 10^{-189}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.15 \cdot 10^{-102}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 6.2 \cdot 10^{+67}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -5.40000000000000017e-247 or -4.3000000000000001e-300 < d4 < 1.4500000000000001e-248 or 1.1000000000000001e-189 < d4 < 2.1499999999999999e-102Initial program 85.5%
associate--l+85.5%
distribute-lft-out--86.2%
distribute-rgt-out--89.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.7%
+-commutative86.7%
associate--r+86.7%
Simplified86.7%
Taylor expanded in d1 around 0 65.7%
if -5.40000000000000017e-247 < d4 < -4.3000000000000001e-300 or 1.4500000000000001e-248 < d4 < 1.1000000000000001e-189 or 2.1499999999999999e-102 < d4 < 6.19999999999999992e67Initial program 80.9%
associate--l+80.9%
distribute-lft-out--85.7%
distribute-rgt-out--87.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 97.1%
+-commutative97.1%
associate--r+97.1%
Simplified97.1%
Taylor expanded in d3 around 0 72.4%
if 6.19999999999999992e67 < d4 Initial program 90.9%
associate--l+90.9%
distribute-lft-out--90.9%
distribute-rgt-out--96.3%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in96.3%
Applied egg-rr96.3%
Taylor expanded in d1 around 0 96.4%
Taylor expanded in d3 around 0 80.4%
+-commutative80.4%
Simplified80.4%
Final simplification70.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d3))))
(if (<= d4 -2.5e+17)
t_0
(if (<= d4 -1.85e-65)
t_1
(if (<= d4 -2.85e-192)
t_0
(if (<= d4 -1.9e-244)
t_1
(if (<= d4 1.05e+68) t_0 (* d1 (+ d2 d4)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * -d3;
double tmp;
if (d4 <= -2.5e+17) {
tmp = t_0;
} else if (d4 <= -1.85e-65) {
tmp = t_1;
} else if (d4 <= -2.85e-192) {
tmp = t_0;
} else if (d4 <= -1.9e-244) {
tmp = t_1;
} else if (d4 <= 1.05e+68) {
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) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * -d3
if (d4 <= (-2.5d+17)) then
tmp = t_0
else if (d4 <= (-1.85d-65)) then
tmp = t_1
else if (d4 <= (-2.85d-192)) then
tmp = t_0
else if (d4 <= (-1.9d-244)) then
tmp = t_1
else if (d4 <= 1.05d+68) 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 t_1 = d1 * -d3;
double tmp;
if (d4 <= -2.5e+17) {
tmp = t_0;
} else if (d4 <= -1.85e-65) {
tmp = t_1;
} else if (d4 <= -2.85e-192) {
tmp = t_0;
} else if (d4 <= -1.9e-244) {
tmp = t_1;
} else if (d4 <= 1.05e+68) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * -d3 tmp = 0 if d4 <= -2.5e+17: tmp = t_0 elif d4 <= -1.85e-65: tmp = t_1 elif d4 <= -2.85e-192: tmp = t_0 elif d4 <= -1.9e-244: tmp = t_1 elif d4 <= 1.05e+68: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d4 <= -2.5e+17) tmp = t_0; elseif (d4 <= -1.85e-65) tmp = t_1; elseif (d4 <= -2.85e-192) tmp = t_0; elseif (d4 <= -1.9e-244) tmp = t_1; elseif (d4 <= 1.05e+68) 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); t_1 = d1 * -d3; tmp = 0.0; if (d4 <= -2.5e+17) tmp = t_0; elseif (d4 <= -1.85e-65) tmp = t_1; elseif (d4 <= -2.85e-192) tmp = t_0; elseif (d4 <= -1.9e-244) tmp = t_1; elseif (d4 <= 1.05e+68) 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]}, Block[{t$95$1 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d4, -2.5e+17], t$95$0, If[LessEqual[d4, -1.85e-65], t$95$1, If[LessEqual[d4, -2.85e-192], t$95$0, If[LessEqual[d4, -1.9e-244], t$95$1, If[LessEqual[d4, 1.05e+68], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq -2.5 \cdot 10^{+17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq -1.85 \cdot 10^{-65}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq -2.85 \cdot 10^{-192}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq -1.9 \cdot 10^{-244}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 1.05 \cdot 10^{+68}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -2.5e17 or -1.85e-65 < d4 < -2.8500000000000001e-192 or -1.9e-244 < d4 < 1.05e68Initial program 83.0%
associate--l+83.0%
distribute-lft-out--85.4%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.3%
+-commutative89.3%
associate--r+89.3%
Simplified89.3%
Taylor expanded in d3 around 0 65.2%
if -2.5e17 < d4 < -1.85e-65 or -2.8500000000000001e-192 < d4 < -1.9e-244Initial program 89.9%
associate--l+89.9%
distribute-lft-out--89.9%
distribute-rgt-out--89.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 39.9%
associate-*r*39.9%
neg-mul-139.9%
Simplified39.9%
if 1.05e68 < d4 Initial program 90.9%
associate--l+90.9%
distribute-lft-out--90.9%
distribute-rgt-out--96.3%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in96.3%
Applied egg-rr96.3%
Taylor expanded in d1 around 0 96.4%
Taylor expanded in d3 around 0 80.4%
+-commutative80.4%
Simplified80.4%
Final simplification65.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (or (<= d3 -1.9e+125)
(not
(or (<= d3 6.2e+173)
(and (not (<= d3 2.5e+230)) (<= d3 1.15e+249)))))
(* d1 (- d3))
(* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.9e+125) || !((d3 <= 6.2e+173) || (!(d3 <= 2.5e+230) && (d3 <= 1.15e+249)))) {
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 <= (-1.9d+125)) .or. (.not. (d3 <= 6.2d+173) .or. (.not. (d3 <= 2.5d+230)) .and. (d3 <= 1.15d+249))) 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 <= -1.9e+125) || !((d3 <= 6.2e+173) || (!(d3 <= 2.5e+230) && (d3 <= 1.15e+249)))) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.9e+125) or not ((d3 <= 6.2e+173) or (not (d3 <= 2.5e+230) and (d3 <= 1.15e+249))): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.9e+125) || !((d3 <= 6.2e+173) || (!(d3 <= 2.5e+230) && (d3 <= 1.15e+249)))) 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 <= -1.9e+125) || ~(((d3 <= 6.2e+173) || (~((d3 <= 2.5e+230)) && (d3 <= 1.15e+249))))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.9e+125], N[Not[Or[LessEqual[d3, 6.2e+173], And[N[Not[LessEqual[d3, 2.5e+230]], $MachinePrecision], LessEqual[d3, 1.15e+249]]]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.9 \cdot 10^{+125} \lor \neg \left(d3 \leq 6.2 \cdot 10^{+173} \lor \neg \left(d3 \leq 2.5 \cdot 10^{+230}\right) \land d3 \leq 1.15 \cdot 10^{+249}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.90000000000000001e125 or 6.2e173 < d3 < 2.5000000000000001e230 or 1.1499999999999999e249 < d3 Initial program 80.9%
associate--l+80.9%
distribute-lft-out--82.3%
distribute-rgt-out--86.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 84.4%
associate-*r*84.4%
neg-mul-184.4%
Simplified84.4%
if -1.90000000000000001e125 < d3 < 6.2e173 or 2.5000000000000001e230 < d3 < 1.1499999999999999e249Initial program 87.2%
associate--l+87.2%
distribute-lft-out--88.8%
distribute-rgt-out--92.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in92.0%
Applied egg-rr92.0%
Taylor expanded in d1 around 0 75.4%
Taylor expanded in d3 around 0 69.7%
+-commutative69.7%
Simplified69.7%
Final simplification73.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -1.05e-184)
(* d1 (- d2 d3))
(if (<= d4 5.2e+31)
(* d1 (- (- d3) d1))
(if (<= d4 1.35e+51)
(* d1 (+ d2 d4))
(if (<= d4 5.7e+69) (* d1 (- d2 d1)) (* d1 (- d4 d3)))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.05e-184) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 5.2e+31) {
tmp = d1 * (-d3 - d1);
} else if (d4 <= 1.35e+51) {
tmp = d1 * (d2 + d4);
} else if (d4 <= 5.7e+69) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= (-1.05d-184)) then
tmp = d1 * (d2 - d3)
else if (d4 <= 5.2d+31) then
tmp = d1 * (-d3 - d1)
else if (d4 <= 1.35d+51) then
tmp = d1 * (d2 + d4)
else if (d4 <= 5.7d+69) then
tmp = d1 * (d2 - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.05e-184) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 5.2e+31) {
tmp = d1 * (-d3 - d1);
} else if (d4 <= 1.35e+51) {
tmp = d1 * (d2 + d4);
} else if (d4 <= 5.7e+69) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -1.05e-184: tmp = d1 * (d2 - d3) elif d4 <= 5.2e+31: tmp = d1 * (-d3 - d1) elif d4 <= 1.35e+51: tmp = d1 * (d2 + d4) elif d4 <= 5.7e+69: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -1.05e-184) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 5.2e+31) tmp = Float64(d1 * Float64(Float64(-d3) - d1)); elseif (d4 <= 1.35e+51) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d4 <= 5.7e+69) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= -1.05e-184) tmp = d1 * (d2 - d3); elseif (d4 <= 5.2e+31) tmp = d1 * (-d3 - d1); elseif (d4 <= 1.35e+51) tmp = d1 * (d2 + d4); elseif (d4 <= 5.7e+69) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -1.05e-184], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 5.2e+31], N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.35e+51], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 5.7e+69], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -1.05 \cdot 10^{-184}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 5.2 \cdot 10^{+31}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{elif}\;d4 \leq 1.35 \cdot 10^{+51}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d4 \leq 5.7 \cdot 10^{+69}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < -1.0499999999999999e-184Initial program 83.0%
associate--l+83.0%
distribute-lft-out--83.0%
distribute-rgt-out--88.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.6%
+-commutative81.6%
associate--r+81.6%
Simplified81.6%
Taylor expanded in d1 around 0 63.8%
if -1.0499999999999999e-184 < d4 < 5.2e31Initial program 86.5%
associate--l+86.5%
distribute-lft-out--91.0%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 98.9%
+-commutative98.9%
associate--r+98.9%
Simplified98.9%
Taylor expanded in d2 around 0 73.9%
associate-*r*73.9%
neg-mul-173.9%
Simplified73.9%
if 5.2e31 < d4 < 1.34999999999999996e51Initial program 80.0%
associate--l+80.0%
distribute-lft-out--80.0%
distribute-rgt-out--80.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in80.0%
Applied egg-rr80.0%
Taylor expanded in d1 around 0 62.1%
Taylor expanded in d3 around 0 82.1%
+-commutative82.1%
Simplified82.1%
if 1.34999999999999996e51 < d4 < 5.7e69Initial program 75.0%
associate--l+75.0%
distribute-lft-out--75.0%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 92.3%
+-commutative92.3%
associate--r+92.3%
Simplified92.3%
Taylor expanded in d3 around 0 92.3%
if 5.7e69 < d4 Initial program 90.7%
associate--l+90.7%
distribute-lft-out--90.7%
distribute-rgt-out--96.3%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in96.3%
Applied egg-rr96.3%
Taylor expanded in d1 around 0 96.3%
Taylor expanded in d2 around 0 83.8%
Final simplification72.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))))
(if (<= d4 -3.8e+24)
(* d1 d2)
(if (<= d4 -2e-71)
t_0
(if (<= d4 -1.8e-180) (* d1 d2) (if (<= d4 1e+72) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d4 <= -3.8e+24) {
tmp = d1 * d2;
} else if (d4 <= -2e-71) {
tmp = t_0;
} else if (d4 <= -1.8e-180) {
tmp = d1 * d2;
} else if (d4 <= 1e+72) {
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 <= (-3.8d+24)) then
tmp = d1 * d2
else if (d4 <= (-2d-71)) then
tmp = t_0
else if (d4 <= (-1.8d-180)) then
tmp = d1 * d2
else if (d4 <= 1d+72) 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 <= -3.8e+24) {
tmp = d1 * d2;
} else if (d4 <= -2e-71) {
tmp = t_0;
} else if (d4 <= -1.8e-180) {
tmp = d1 * d2;
} else if (d4 <= 1e+72) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 tmp = 0 if d4 <= -3.8e+24: tmp = d1 * d2 elif d4 <= -2e-71: tmp = t_0 elif d4 <= -1.8e-180: tmp = d1 * d2 elif d4 <= 1e+72: 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 <= -3.8e+24) tmp = Float64(d1 * d2); elseif (d4 <= -2e-71) tmp = t_0; elseif (d4 <= -1.8e-180) tmp = Float64(d1 * d2); elseif (d4 <= 1e+72) 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 <= -3.8e+24) tmp = d1 * d2; elseif (d4 <= -2e-71) tmp = t_0; elseif (d4 <= -1.8e-180) tmp = d1 * d2; elseif (d4 <= 1e+72) 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, -3.8e+24], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, -2e-71], t$95$0, If[LessEqual[d4, -1.8e-180], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1e+72], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq -3.8 \cdot 10^{+24}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq -2 \cdot 10^{-71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq -1.8 \cdot 10^{-180}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 10^{+72}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -3.80000000000000015e24 or -1.9999999999999998e-71 < d4 < -1.8e-180Initial program 81.0%
associate--l+81.0%
distribute-lft-out--81.0%
distribute-rgt-out--87.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 38.9%
if -3.80000000000000015e24 < d4 < -1.9999999999999998e-71 or -1.8e-180 < d4 < 9.99999999999999944e71Initial program 86.2%
associate--l+86.2%
distribute-lft-out--89.4%
distribute-rgt-out--90.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 35.5%
associate-*r*35.5%
neg-mul-135.5%
Simplified35.5%
if 9.99999999999999944e71 < d4 Initial program 90.7%
associate--l+90.7%
distribute-lft-out--90.7%
distribute-rgt-out--96.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 67.6%
Final simplification43.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d2 -1.4e+44)
(* d1 (- d2 d3))
(if (or (<= d2 -5e-263) (not (<= d2 -5.8e-276)))
(* d1 (- d4 d1))
(* d1 (- d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.4e+44) {
tmp = d1 * (d2 - d3);
} else if ((d2 <= -5e-263) || !(d2 <= -5.8e-276)) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * -d3;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.4d+44)) then
tmp = d1 * (d2 - d3)
else if ((d2 <= (-5d-263)) .or. (.not. (d2 <= (-5.8d-276)))) then
tmp = d1 * (d4 - d1)
else
tmp = d1 * -d3
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.4e+44) {
tmp = d1 * (d2 - d3);
} else if ((d2 <= -5e-263) || !(d2 <= -5.8e-276)) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * -d3;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.4e+44: tmp = d1 * (d2 - d3) elif (d2 <= -5e-263) or not (d2 <= -5.8e-276): tmp = d1 * (d4 - d1) else: tmp = d1 * -d3 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.4e+44) tmp = Float64(d1 * Float64(d2 - d3)); elseif ((d2 <= -5e-263) || !(d2 <= -5.8e-276)) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(-d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.4e+44) tmp = d1 * (d2 - d3); elseif ((d2 <= -5e-263) || ~((d2 <= -5.8e-276))) tmp = d1 * (d4 - d1); else tmp = d1 * -d3; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.4e+44], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[d2, -5e-263], N[Not[LessEqual[d2, -5.8e-276]], $MachinePrecision]], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * (-d3)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.4 \cdot 10^{+44}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -5 \cdot 10^{-263} \lor \neg \left(d2 \leq -5.8 \cdot 10^{-276}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\end{array}
\end{array}
if d2 < -1.4e44Initial program 88.6%
associate--l+88.6%
distribute-lft-out--88.6%
distribute-rgt-out--92.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 83.4%
+-commutative83.4%
associate--r+83.4%
Simplified83.4%
Taylor expanded in d1 around 0 77.7%
if -1.4e44 < d2 < -5.00000000000000006e-263 or -5.79999999999999975e-276 < d2 Initial program 84.9%
associate--l+84.9%
distribute-lft-out--86.9%
distribute-rgt-out--90.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.4%
Taylor expanded in d2 around 0 55.7%
if -5.00000000000000006e-263 < d2 < -5.79999999999999975e-276Initial program 75.0%
associate--l+75.0%
distribute-lft-out--75.0%
distribute-rgt-out--75.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 76.0%
associate-*r*76.0%
neg-mul-176.0%
Simplified76.0%
Final simplification60.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d1 -1.85e+150)
(* d1 (- d2 d1))
(if (<= d1 -6.4e-251)
(* d1 (- d4 d3))
(if (<= d1 2.9e+20) (* d1 (- d2 d3)) (* d1 (- d4 d1))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d1 <= -1.85e+150) {
tmp = d1 * (d2 - d1);
} else if (d1 <= -6.4e-251) {
tmp = d1 * (d4 - d3);
} else if (d1 <= 2.9e+20) {
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 (d1 <= (-1.85d+150)) then
tmp = d1 * (d2 - d1)
else if (d1 <= (-6.4d-251)) then
tmp = d1 * (d4 - d3)
else if (d1 <= 2.9d+20) 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 (d1 <= -1.85e+150) {
tmp = d1 * (d2 - d1);
} else if (d1 <= -6.4e-251) {
tmp = d1 * (d4 - d3);
} else if (d1 <= 2.9e+20) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d1 <= -1.85e+150: tmp = d1 * (d2 - d1) elif d1 <= -6.4e-251: tmp = d1 * (d4 - d3) elif d1 <= 2.9e+20: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d1 <= -1.85e+150) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d1 <= -6.4e-251) tmp = Float64(d1 * Float64(d4 - d3)); elseif (d1 <= 2.9e+20) 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 (d1 <= -1.85e+150) tmp = d1 * (d2 - d1); elseif (d1 <= -6.4e-251) tmp = d1 * (d4 - d3); elseif (d1 <= 2.9e+20) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d1, -1.85e+150], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, -6.4e-251], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 2.9e+20], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -1.85 \cdot 10^{+150}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d1 \leq -6.4 \cdot 10^{-251}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{elif}\;d1 \leq 2.9 \cdot 10^{+20}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d1 < -1.84999999999999994e150Initial program 57.6%
associate--l+57.6%
distribute-lft-out--60.6%
distribute-rgt-out--75.8%
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 97.0%
if -1.84999999999999994e150 < d1 < -6.39999999999999963e-251Initial program 97.7%
associate--l+97.7%
distribute-lft-out--98.8%
distribute-rgt-out--98.8%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in98.8%
Applied egg-rr98.8%
Taylor expanded in d1 around 0 91.4%
Taylor expanded in d2 around 0 57.8%
if -6.39999999999999963e-251 < d1 < 2.9e20Initial 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 d4 around 0 74.4%
+-commutative74.4%
associate--r+74.4%
Simplified74.4%
Taylor expanded in d1 around 0 72.9%
if 2.9e20 < d1 Initial program 70.0%
associate--l+70.0%
distribute-lft-out--72.8%
distribute-rgt-out--78.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 86.8%
Taylor expanded in d2 around 0 59.9%
Final simplification67.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -3e+152) (* d1 (- d2 d3)) (if (<= d3 6.6e+108) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -3e+152) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 6.6e+108) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d3 <= (-3d+152)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 6.6d+108) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -3e+152) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 6.6e+108) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -3e+152: tmp = d1 * (d2 - d3) elif d3 <= 6.6e+108: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -3e+152) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 6.6e+108) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -3e+152) tmp = d1 * (d2 - d3); elseif (d3 <= 6.6e+108) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -3e+152], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 6.6e+108], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -3 \cdot 10^{+152}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 6.6 \cdot 10^{+108}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -2.99999999999999991e152Initial program 86.8%
associate--l+86.8%
distribute-lft-out--86.8%
distribute-rgt-out--89.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 94.9%
+-commutative94.9%
associate--r+94.9%
Simplified94.9%
Taylor expanded in d1 around 0 89.7%
if -2.99999999999999991e152 < d3 < 6.60000000000000038e108Initial program 87.9%
associate--l+87.9%
distribute-lft-out--88.5%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.2%
if 6.60000000000000038e108 < d3 Initial program 74.9%
associate--l+74.9%
distribute-lft-out--81.7%
distribute-rgt-out--84.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in84.0%
Applied egg-rr84.0%
Taylor expanded in d1 around 0 95.4%
Taylor expanded in d2 around 0 79.7%
Final simplification92.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -3.9e+146) (* d1 (- (+ d2 d4) d3)) (if (<= d3 5.5e+108) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -3.9e+146) {
tmp = d1 * ((d2 + d4) - d3);
} else if (d3 <= 5.5e+108) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d3 <= (-3.9d+146)) then
tmp = d1 * ((d2 + d4) - d3)
else if (d3 <= 5.5d+108) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -3.9e+146) {
tmp = d1 * ((d2 + d4) - d3);
} else if (d3 <= 5.5e+108) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -3.9e+146: tmp = d1 * ((d2 + d4) - d3) elif d3 <= 5.5e+108: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -3.9e+146) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); elseif (d3 <= 5.5e+108) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -3.9e+146) tmp = d1 * ((d2 + d4) - d3); elseif (d3 <= 5.5e+108) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -3.9e+146], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 5.5e+108], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -3.9 \cdot 10^{+146}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{elif}\;d3 \leq 5.5 \cdot 10^{+108}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -3.9e146Initial program 86.8%
associate--l+86.8%
distribute-lft-out--86.8%
distribute-rgt-out--89.5%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in89.5%
Applied egg-rr89.5%
Taylor expanded in d1 around 0 94.7%
if -3.9e146 < d3 < 5.4999999999999998e108Initial program 87.9%
associate--l+87.9%
distribute-lft-out--88.5%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.2%
if 5.4999999999999998e108 < d3 Initial program 74.9%
associate--l+74.9%
distribute-lft-out--81.7%
distribute-rgt-out--84.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in84.0%
Applied egg-rr84.0%
Taylor expanded in d1 around 0 95.4%
Taylor expanded in d2 around 0 79.7%
Final simplification93.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -4.3e+101) (* d1 (- (- d2 d3) d1)) (if (<= d3 1.5e+105) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -4.3e+101) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d3 <= 1.5e+105) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d3 <= (-4.3d+101)) then
tmp = d1 * ((d2 - d3) - d1)
else if (d3 <= 1.5d+105) then
tmp = d1 * ((d2 + d4) - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -4.3e+101) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d3 <= 1.5e+105) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -4.3e+101: tmp = d1 * ((d2 - d3) - d1) elif d3 <= 1.5e+105: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -4.3e+101) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); elseif (d3 <= 1.5e+105) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d3 <= -4.3e+101) tmp = d1 * ((d2 - d3) - d1); elseif (d3 <= 1.5e+105) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -4.3e+101], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.5e+105], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -4.3 \cdot 10^{+101}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{elif}\;d3 \leq 1.5 \cdot 10^{+105}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -4.3000000000000001e101Initial program 82.2%
associate--l+82.2%
distribute-lft-out--82.2%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 93.5%
+-commutative93.5%
associate--r+93.5%
Simplified93.5%
if -4.3000000000000001e101 < d3 < 1.5e105Initial program 89.2%
associate--l+89.2%
distribute-lft-out--89.8%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 96.7%
if 1.5e105 < d3 Initial program 74.9%
associate--l+74.9%
distribute-lft-out--81.7%
distribute-rgt-out--84.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in84.0%
Applied egg-rr84.0%
Taylor expanded in d1 around 0 95.4%
Taylor expanded in d2 around 0 79.7%
Final simplification93.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -9e+54) (* d1 (- (+ d2 d4) d3)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -9e+54) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-9d+54)) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * ((d4 - d3) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -9e+54) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -9e+54: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -9e+54) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(Float64(d4 - d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -9e+54) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -9e+54], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -9 \cdot 10^{+54}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d2 < -8.99999999999999968e54Initial program 87.7%
associate--l+87.7%
distribute-lft-out--87.8%
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 94.0%
if -8.99999999999999968e54 < d2 Initial program 85.0%
associate--l+85.0%
distribute-lft-out--86.9%
distribute-rgt-out--90.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 78.8%
+-commutative78.8%
associate--r+78.8%
Simplified78.8%
Final simplification81.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.22e-11) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.22e-11) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 1.22d-11) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.22e-11) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.22e-11: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.22e-11) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.22e-11) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.22e-11], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.22 \cdot 10^{-11}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.2200000000000001e-11Initial program 85.2%
associate--l+85.2%
distribute-lft-out--87.5%
distribute-rgt-out--90.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 37.1%
if 1.2200000000000001e-11 < d4 Initial program 86.2%
associate--l+86.2%
distribute-lft-out--86.2%
distribute-rgt-out--91.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 50.4%
Final simplification41.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 85.5%
associate--l+85.5%
distribute-lft-out--87.1%
distribute-rgt-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.3%
Final simplification33.3%
(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 2024067
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))