
(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 13 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 89.4%
associate--l+89.4%
distribute-lft-out--89.4%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (+ d2 d4)))
(t_1 (- (* d1 d3)))
(t_2 (* d1 (- d4 d1)))
(t_3 (* d1 (- d2 d1))))
(if (<= d3 -2.05e+153)
t_1
(if (<= d3 -2.9e-15)
t_3
(if (<= d3 -1.25e-83)
t_0
(if (<= d3 -2.8e-172)
t_2
(if (<= d3 -3.8e-188)
t_0
(if (<= d3 1.55e-66) t_2 (if (<= d3 2.1e+117) t_3 t_1)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 + d4);
double t_1 = -(d1 * d3);
double t_2 = d1 * (d4 - d1);
double t_3 = d1 * (d2 - d1);
double tmp;
if (d3 <= -2.05e+153) {
tmp = t_1;
} else if (d3 <= -2.9e-15) {
tmp = t_3;
} else if (d3 <= -1.25e-83) {
tmp = t_0;
} else if (d3 <= -2.8e-172) {
tmp = t_2;
} else if (d3 <= -3.8e-188) {
tmp = t_0;
} else if (d3 <= 1.55e-66) {
tmp = t_2;
} else if (d3 <= 2.1e+117) {
tmp = t_3;
} else {
tmp = t_1;
}
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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = d1 * (d2 + d4)
t_1 = -(d1 * d3)
t_2 = d1 * (d4 - d1)
t_3 = d1 * (d2 - d1)
if (d3 <= (-2.05d+153)) then
tmp = t_1
else if (d3 <= (-2.9d-15)) then
tmp = t_3
else if (d3 <= (-1.25d-83)) then
tmp = t_0
else if (d3 <= (-2.8d-172)) then
tmp = t_2
else if (d3 <= (-3.8d-188)) then
tmp = t_0
else if (d3 <= 1.55d-66) then
tmp = t_2
else if (d3 <= 2.1d+117) then
tmp = t_3
else
tmp = t_1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 + d4);
double t_1 = -(d1 * d3);
double t_2 = d1 * (d4 - d1);
double t_3 = d1 * (d2 - d1);
double tmp;
if (d3 <= -2.05e+153) {
tmp = t_1;
} else if (d3 <= -2.9e-15) {
tmp = t_3;
} else if (d3 <= -1.25e-83) {
tmp = t_0;
} else if (d3 <= -2.8e-172) {
tmp = t_2;
} else if (d3 <= -3.8e-188) {
tmp = t_0;
} else if (d3 <= 1.55e-66) {
tmp = t_2;
} else if (d3 <= 2.1e+117) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 + d4) t_1 = -(d1 * d3) t_2 = d1 * (d4 - d1) t_3 = d1 * (d2 - d1) tmp = 0 if d3 <= -2.05e+153: tmp = t_1 elif d3 <= -2.9e-15: tmp = t_3 elif d3 <= -1.25e-83: tmp = t_0 elif d3 <= -2.8e-172: tmp = t_2 elif d3 <= -3.8e-188: tmp = t_0 elif d3 <= 1.55e-66: tmp = t_2 elif d3 <= 2.1e+117: tmp = t_3 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 + d4)) t_1 = Float64(-Float64(d1 * d3)) t_2 = Float64(d1 * Float64(d4 - d1)) t_3 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d3 <= -2.05e+153) tmp = t_1; elseif (d3 <= -2.9e-15) tmp = t_3; elseif (d3 <= -1.25e-83) tmp = t_0; elseif (d3 <= -2.8e-172) tmp = t_2; elseif (d3 <= -3.8e-188) tmp = t_0; elseif (d3 <= 1.55e-66) tmp = t_2; elseif (d3 <= 2.1e+117) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 + d4); t_1 = -(d1 * d3); t_2 = d1 * (d4 - d1); t_3 = d1 * (d2 - d1); tmp = 0.0; if (d3 <= -2.05e+153) tmp = t_1; elseif (d3 <= -2.9e-15) tmp = t_3; elseif (d3 <= -1.25e-83) tmp = t_0; elseif (d3 <= -2.8e-172) tmp = t_2; elseif (d3 <= -3.8e-188) tmp = t_0; elseif (d3 <= 1.55e-66) tmp = t_2; elseif (d3 <= 2.1e+117) tmp = t_3; else tmp = t_1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[(d1 * d3), $MachinePrecision])}, Block[{t$95$2 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -2.05e+153], t$95$1, If[LessEqual[d3, -2.9e-15], t$95$3, If[LessEqual[d3, -1.25e-83], t$95$0, If[LessEqual[d3, -2.8e-172], t$95$2, If[LessEqual[d3, -3.8e-188], t$95$0, If[LessEqual[d3, 1.55e-66], t$95$2, If[LessEqual[d3, 2.1e+117], t$95$3, t$95$1]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 + d4\right)\\
t_1 := -d1 \cdot d3\\
t_2 := d1 \cdot \left(d4 - d1\right)\\
t_3 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d3 \leq -2.05 \cdot 10^{+153}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -2.9 \cdot 10^{-15}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;d3 \leq -1.25 \cdot 10^{-83}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -2.8 \cdot 10^{-172}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq -3.8 \cdot 10^{-188}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 1.55 \cdot 10^{-66}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 2.1 \cdot 10^{+117}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d3 < -2.05000000000000008e153 or 2.1000000000000001e117 < d3 Initial program 90.7%
associate--l+90.7%
distribute-lft-out--90.7%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 81.2%
mul-1-neg81.2%
distribute-rgt-neg-out81.2%
Simplified81.2%
if -2.05000000000000008e153 < d3 < -2.90000000000000019e-15 or 1.5499999999999999e-66 < d3 < 2.1000000000000001e117Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--91.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 79.2%
Taylor expanded in d3 around 0 60.4%
if -2.90000000000000019e-15 < d3 < -1.25e-83 or -2.80000000000000011e-172 < d3 < -3.8e-188Initial program 91.3%
associate--l+91.3%
distribute-lft-out--91.3%
distribute-rgt-out--91.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 87.2%
Taylor expanded in d3 around 0 87.2%
+-commutative87.2%
Simplified87.2%
if -1.25e-83 < d3 < -2.80000000000000011e-172 or -3.8e-188 < d3 < 1.5499999999999999e-66Initial program 89.7%
associate--l+89.7%
distribute-lft-out--89.8%
distribute-rgt-out--93.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 75.7%
Taylor expanded in d3 around 0 74.2%
Final simplification72.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (- (* d1 d3))))
(if (<= d4 -1.45e-203)
(* d1 d2)
(if (<= d4 1.2e-192)
t_1
(if (<= d4 9.2e-177)
(* d1 d2)
(if (<= d4 1.2e-118)
t_1
(if (<= d4 2e+36)
t_0
(if (<= d4 1.42e+77)
t_1
(if (<= d4 2.05e+92) t_0 (* d1 d4))))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = -(d1 * d3);
double tmp;
if (d4 <= -1.45e-203) {
tmp = d1 * d2;
} else if (d4 <= 1.2e-192) {
tmp = t_1;
} else if (d4 <= 9.2e-177) {
tmp = d1 * d2;
} else if (d4 <= 1.2e-118) {
tmp = t_1;
} else if (d4 <= 2e+36) {
tmp = t_0;
} else if (d4 <= 1.42e+77) {
tmp = t_1;
} else if (d4 <= 2.05e+92) {
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) :: t_1
real(8) :: tmp
t_0 = d1 * -d1
t_1 = -(d1 * d3)
if (d4 <= (-1.45d-203)) then
tmp = d1 * d2
else if (d4 <= 1.2d-192) then
tmp = t_1
else if (d4 <= 9.2d-177) then
tmp = d1 * d2
else if (d4 <= 1.2d-118) then
tmp = t_1
else if (d4 <= 2d+36) then
tmp = t_0
else if (d4 <= 1.42d+77) then
tmp = t_1
else if (d4 <= 2.05d+92) 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 * -d1;
double t_1 = -(d1 * d3);
double tmp;
if (d4 <= -1.45e-203) {
tmp = d1 * d2;
} else if (d4 <= 1.2e-192) {
tmp = t_1;
} else if (d4 <= 9.2e-177) {
tmp = d1 * d2;
} else if (d4 <= 1.2e-118) {
tmp = t_1;
} else if (d4 <= 2e+36) {
tmp = t_0;
} else if (d4 <= 1.42e+77) {
tmp = t_1;
} else if (d4 <= 2.05e+92) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = -(d1 * d3) tmp = 0 if d4 <= -1.45e-203: tmp = d1 * d2 elif d4 <= 1.2e-192: tmp = t_1 elif d4 <= 9.2e-177: tmp = d1 * d2 elif d4 <= 1.2e-118: tmp = t_1 elif d4 <= 2e+36: tmp = t_0 elif d4 <= 1.42e+77: tmp = t_1 elif d4 <= 2.05e+92: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(-Float64(d1 * d3)) tmp = 0.0 if (d4 <= -1.45e-203) tmp = Float64(d1 * d2); elseif (d4 <= 1.2e-192) tmp = t_1; elseif (d4 <= 9.2e-177) tmp = Float64(d1 * d2); elseif (d4 <= 1.2e-118) tmp = t_1; elseif (d4 <= 2e+36) tmp = t_0; elseif (d4 <= 1.42e+77) tmp = t_1; elseif (d4 <= 2.05e+92) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = -(d1 * d3); tmp = 0.0; if (d4 <= -1.45e-203) tmp = d1 * d2; elseif (d4 <= 1.2e-192) tmp = t_1; elseif (d4 <= 9.2e-177) tmp = d1 * d2; elseif (d4 <= 1.2e-118) tmp = t_1; elseif (d4 <= 2e+36) tmp = t_0; elseif (d4 <= 1.42e+77) tmp = t_1; elseif (d4 <= 2.05e+92) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$1 = (-N[(d1 * d3), $MachinePrecision])}, If[LessEqual[d4, -1.45e-203], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.2e-192], t$95$1, If[LessEqual[d4, 9.2e-177], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.2e-118], t$95$1, If[LessEqual[d4, 2e+36], t$95$0, If[LessEqual[d4, 1.42e+77], t$95$1, If[LessEqual[d4, 2.05e+92], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := -d1 \cdot d3\\
\mathbf{if}\;d4 \leq -1.45 \cdot 10^{-203}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.2 \cdot 10^{-192}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 9.2 \cdot 10^{-177}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.2 \cdot 10^{-118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 2 \cdot 10^{+36}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.42 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 2.05 \cdot 10^{+92}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -1.4499999999999999e-203 or 1.2e-192 < d4 < 9.20000000000000087e-177Initial program 89.3%
associate--l+89.3%
distribute-lft-out--89.3%
distribute-rgt-out--95.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.2%
if -1.4499999999999999e-203 < d4 < 1.2e-192 or 9.20000000000000087e-177 < d4 < 1.2000000000000001e-118 or 2.00000000000000008e36 < d4 < 1.41999999999999993e77Initial program 89.8%
associate--l+89.8%
distribute-lft-out--89.9%
distribute-rgt-out--91.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 50.3%
mul-1-neg50.3%
distribute-rgt-neg-out50.3%
Simplified50.3%
if 1.2000000000000001e-118 < d4 < 2.00000000000000008e36 or 1.41999999999999993e77 < d4 < 2.05000000000000012e92Initial program 90.0%
associate--l+90.0%
distribute-lft-out--90.0%
distribute-rgt-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 59.0%
unpow259.0%
neg-mul-159.0%
Simplified59.0%
if 2.05000000000000012e92 < d4 Initial program 88.6%
associate--l+88.6%
distribute-lft-out--88.6%
distribute-rgt-out--88.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 60.3%
Final simplification47.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- (- d1) d3))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -1.2e-203)
t_1
(if (<= d4 1.4e-258)
t_0
(if (<= d4 2e-103) t_1 (if (<= d4 4.4e+92) t_0 (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (-d1 - d3);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -1.2e-203) {
tmp = t_1;
} else if (d4 <= 1.4e-258) {
tmp = t_0;
} else if (d4 <= 2e-103) {
tmp = t_1;
} else if (d4 <= 4.4e+92) {
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) :: t_1
real(8) :: tmp
t_0 = d1 * (-d1 - d3)
t_1 = d1 * (d2 - d3)
if (d4 <= (-1.2d-203)) then
tmp = t_1
else if (d4 <= 1.4d-258) then
tmp = t_0
else if (d4 <= 2d-103) then
tmp = t_1
else if (d4 <= 4.4d+92) 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 * (-d1 - d3);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -1.2e-203) {
tmp = t_1;
} else if (d4 <= 1.4e-258) {
tmp = t_0;
} else if (d4 <= 2e-103) {
tmp = t_1;
} else if (d4 <= 4.4e+92) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (-d1 - d3) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -1.2e-203: tmp = t_1 elif d4 <= 1.4e-258: tmp = t_0 elif d4 <= 2e-103: tmp = t_1 elif d4 <= 4.4e+92: tmp = t_0 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(Float64(-d1) - d3)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= -1.2e-203) tmp = t_1; elseif (d4 <= 1.4e-258) tmp = t_0; elseif (d4 <= 2e-103) tmp = t_1; elseif (d4 <= 4.4e+92) 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 * (-d1 - d3); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= -1.2e-203) tmp = t_1; elseif (d4 <= 1.4e-258) tmp = t_0; elseif (d4 <= 2e-103) tmp = t_1; elseif (d4 <= 4.4e+92) 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[((-d1) - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, -1.2e-203], t$95$1, If[LessEqual[d4, 1.4e-258], t$95$0, If[LessEqual[d4, 2e-103], t$95$1, If[LessEqual[d4, 4.4e+92], t$95$0, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(\left(-d1\right) - d3\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq -1.2 \cdot 10^{-203}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 1.4 \cdot 10^{-258}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 2 \cdot 10^{-103}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 4.4 \cdot 10^{+92}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < -1.1999999999999999e-203 or 1.4000000000000001e-258 < d4 < 1.99999999999999992e-103Initial program 90.3%
associate--l+90.3%
distribute-lft-out--90.3%
distribute-rgt-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.4%
Taylor expanded in d1 around 0 65.6%
if -1.1999999999999999e-203 < d4 < 1.4000000000000001e-258 or 1.99999999999999992e-103 < d4 < 4.39999999999999984e92Initial program 88.5%
associate--l+88.5%
distribute-lft-out--88.5%
distribute-rgt-out--89.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 91.8%
Taylor expanded in d2 around 0 80.2%
mul-1-neg80.2%
*-commutative80.2%
distribute-rgt-neg-out80.2%
distribute-neg-in80.2%
unsub-neg80.2%
Simplified80.2%
if 4.39999999999999984e92 < d4 Initial program 88.6%
associate--l+88.6%
distribute-lft-out--88.6%
distribute-rgt-out--88.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 77.4%
Taylor expanded in d1 around 0 75.9%
Final simplification71.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))))
(if (<= d4 -2.2e-220)
(* d1 d2)
(if (<= d4 2.5e-255)
t_0
(if (<= d4 1.8e-143) (* d1 d2) (if (<= d4 3e+59) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double tmp;
if (d4 <= -2.2e-220) {
tmp = d1 * d2;
} else if (d4 <= 2.5e-255) {
tmp = t_0;
} else if (d4 <= 1.8e-143) {
tmp = d1 * d2;
} else if (d4 <= 3e+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 * -d1
if (d4 <= (-2.2d-220)) then
tmp = d1 * d2
else if (d4 <= 2.5d-255) then
tmp = t_0
else if (d4 <= 1.8d-143) then
tmp = d1 * d2
else if (d4 <= 3d+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 * -d1;
double tmp;
if (d4 <= -2.2e-220) {
tmp = d1 * d2;
} else if (d4 <= 2.5e-255) {
tmp = t_0;
} else if (d4 <= 1.8e-143) {
tmp = d1 * d2;
} else if (d4 <= 3e+59) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 tmp = 0 if d4 <= -2.2e-220: tmp = d1 * d2 elif d4 <= 2.5e-255: tmp = t_0 elif d4 <= 1.8e-143: tmp = d1 * d2 elif d4 <= 3e+59: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) tmp = 0.0 if (d4 <= -2.2e-220) tmp = Float64(d1 * d2); elseif (d4 <= 2.5e-255) tmp = t_0; elseif (d4 <= 1.8e-143) tmp = Float64(d1 * d2); elseif (d4 <= 3e+59) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; tmp = 0.0; if (d4 <= -2.2e-220) tmp = d1 * d2; elseif (d4 <= 2.5e-255) tmp = t_0; elseif (d4 <= 1.8e-143) tmp = d1 * d2; elseif (d4 <= 3e+59) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, If[LessEqual[d4, -2.2e-220], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 2.5e-255], t$95$0, If[LessEqual[d4, 1.8e-143], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 3e+59], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
\mathbf{if}\;d4 \leq -2.2 \cdot 10^{-220}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 2.5 \cdot 10^{-255}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.8 \cdot 10^{-143}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 3 \cdot 10^{+59}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -2.19999999999999987e-220 or 2.4999999999999998e-255 < d4 < 1.7999999999999999e-143Initial program 90.2%
associate--l+90.2%
distribute-lft-out--90.2%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.4%
if -2.19999999999999987e-220 < d4 < 2.4999999999999998e-255 or 1.7999999999999999e-143 < d4 < 3e59Initial program 89.0%
associate--l+89.0%
distribute-lft-out--89.0%
distribute-rgt-out--90.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around inf 55.6%
unpow255.6%
neg-mul-155.6%
Simplified55.6%
if 3e59 < d4 Initial program 88.0%
associate--l+88.0%
distribute-lft-out--88.0%
distribute-rgt-out--88.0%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 59.4%
Final simplification45.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (- (* d1 d3))))
(if (<= d3 -3.6e+158)
t_0
(if (<= d3 -1.55e-80)
(* d1 (+ d2 d4))
(if (<= d3 5.8e+80) (* d1 (- d4 d1)) t_0)))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = -(d1 * d3);
double tmp;
if (d3 <= -3.6e+158) {
tmp = t_0;
} else if (d3 <= -1.55e-80) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 5.8e+80) {
tmp = d1 * (d4 - d1);
} 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 * d3)
if (d3 <= (-3.6d+158)) then
tmp = t_0
else if (d3 <= (-1.55d-80)) then
tmp = d1 * (d2 + d4)
else if (d3 <= 5.8d+80) then
tmp = d1 * (d4 - d1)
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 * d3);
double tmp;
if (d3 <= -3.6e+158) {
tmp = t_0;
} else if (d3 <= -1.55e-80) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 5.8e+80) {
tmp = d1 * (d4 - d1);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = -(d1 * d3) tmp = 0 if d3 <= -3.6e+158: tmp = t_0 elif d3 <= -1.55e-80: tmp = d1 * (d2 + d4) elif d3 <= 5.8e+80: tmp = d1 * (d4 - d1) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(-Float64(d1 * d3)) tmp = 0.0 if (d3 <= -3.6e+158) tmp = t_0; elseif (d3 <= -1.55e-80) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d3 <= 5.8e+80) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = -(d1 * d3); tmp = 0.0; if (d3 <= -3.6e+158) tmp = t_0; elseif (d3 <= -1.55e-80) tmp = d1 * (d2 + d4); elseif (d3 <= 5.8e+80) tmp = d1 * (d4 - d1); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = (-N[(d1 * d3), $MachinePrecision])}, If[LessEqual[d3, -3.6e+158], t$95$0, If[LessEqual[d3, -1.55e-80], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 5.8e+80], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -d1 \cdot d3\\
\mathbf{if}\;d3 \leq -3.6 \cdot 10^{+158}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -1.55 \cdot 10^{-80}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d3 \leq 5.8 \cdot 10^{+80}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -3.59999999999999988e158 or 5.79999999999999971e80 < d3 Initial program 89.2%
associate--l+89.2%
distribute-lft-out--89.2%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 77.1%
mul-1-neg77.1%
distribute-rgt-neg-out77.1%
Simplified77.1%
if -3.59999999999999988e158 < d3 < -1.55000000000000008e-80Initial program 90.2%
associate--l+90.2%
distribute-lft-out--90.2%
distribute-rgt-out--90.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 85.5%
Taylor expanded in d3 around 0 64.0%
+-commutative64.0%
Simplified64.0%
if -1.55000000000000008e-80 < d3 < 5.79999999999999971e80Initial program 89.3%
associate--l+89.3%
distribute-lft-out--89.3%
distribute-rgt-out--93.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 76.3%
Taylor expanded in d3 around 0 71.5%
Final simplification71.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d3 -4.6e+41)
(* d1 (- d2 d3))
(if (<= d3 1.85e-68)
(* d1 (- d4 d1))
(if (<= d3 1.55e+107) (* d1 (- d2 d1)) (* d1 (- d4 d3))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -4.6e+41) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 1.85e-68) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 1.55e+107) {
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 (d3 <= (-4.6d+41)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 1.85d-68) then
tmp = d1 * (d4 - d1)
else if (d3 <= 1.55d+107) 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 (d3 <= -4.6e+41) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 1.85e-68) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 1.55e+107) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -4.6e+41: tmp = d1 * (d2 - d3) elif d3 <= 1.85e-68: tmp = d1 * (d4 - d1) elif d3 <= 1.55e+107: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -4.6e+41) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 1.85e-68) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d3 <= 1.55e+107) 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 (d3 <= -4.6e+41) tmp = d1 * (d2 - d3); elseif (d3 <= 1.85e-68) tmp = d1 * (d4 - d1); elseif (d3 <= 1.55e+107) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -4.6e+41], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.85e-68], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.55e+107], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -4.6 \cdot 10^{+41}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 1.85 \cdot 10^{-68}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d3 \leq 1.55 \cdot 10^{+107}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -4.5999999999999997e41Initial program 94.6%
associate--l+94.6%
distribute-lft-out--94.6%
distribute-rgt-out--96.4%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 84.3%
Taylor expanded in d1 around 0 77.4%
if -4.5999999999999997e41 < d3 < 1.85000000000000001e-68Initial program 89.0%
associate--l+89.0%
distribute-lft-out--89.1%
distribute-rgt-out--91.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 72.3%
Taylor expanded in d3 around 0 69.5%
if 1.85000000000000001e-68 < d3 < 1.55000000000000013e107Initial program 85.4%
associate--l+85.4%
distribute-lft-out--85.4%
distribute-rgt-out--92.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 83.3%
Taylor expanded in d3 around 0 64.8%
if 1.55000000000000013e107 < d3 Initial program 87.5%
associate--l+87.5%
distribute-lft-out--87.5%
distribute-rgt-out--87.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 94.4%
Taylor expanded in d1 around 0 87.8%
Final simplification73.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -9e+154) (not (<= d3 6.5e+80))) (- (* d1 d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -9e+154) || !(d3 <= 6.5e+80)) {
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 <= (-9d+154)) .or. (.not. (d3 <= 6.5d+80))) 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 <= -9e+154) || !(d3 <= 6.5e+80)) {
tmp = -(d1 * d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -9e+154) or not (d3 <= 6.5e+80): tmp = -(d1 * d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -9e+154) || !(d3 <= 6.5e+80)) tmp = Float64(-Float64(d1 * 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 <= -9e+154) || ~((d3 <= 6.5e+80))) tmp = -(d1 * d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -9e+154], N[Not[LessEqual[d3, 6.5e+80]], $MachinePrecision]], (-N[(d1 * d3), $MachinePrecision]), N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -9 \cdot 10^{+154} \lor \neg \left(d3 \leq 6.5 \cdot 10^{+80}\right):\\
\;\;\;\;-d1 \cdot d3\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -9.00000000000000018e154 or 6.4999999999999998e80 < d3 Initial program 89.2%
associate--l+89.2%
distribute-lft-out--89.2%
distribute-rgt-out--91.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 77.1%
mul-1-neg77.1%
distribute-rgt-neg-out77.1%
Simplified77.1%
if -9.00000000000000018e154 < d3 < 6.4999999999999998e80Initial program 89.5%
associate--l+89.5%
distribute-lft-out--89.6%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d1 around 0 71.9%
Taylor expanded in d3 around 0 61.8%
+-commutative61.8%
Simplified61.8%
Final simplification66.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -7e+41) (not (<= d3 2.35e-17))) (* d1 (- d2 d3)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -7e+41) || !(d3 <= 2.35e-17)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-7d+41)) .or. (.not. (d3 <= 2.35d-17))) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -7e+41) || !(d3 <= 2.35e-17)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -7e+41) or not (d3 <= 2.35e-17): tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -7e+41) || !(d3 <= 2.35e-17)) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -7e+41) || ~((d3 <= 2.35e-17))) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -7e+41], N[Not[LessEqual[d3, 2.35e-17]], $MachinePrecision]], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -7 \cdot 10^{+41} \lor \neg \left(d3 \leq 2.35 \cdot 10^{-17}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d3 < -6.9999999999999998e41 or 2.35e-17 < d3 Initial program 90.5%
associate--l+90.5%
distribute-lft-out--90.5%
distribute-rgt-out--92.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 86.9%
Taylor expanded in d1 around 0 75.4%
if -6.9999999999999998e41 < d3 < 2.35e-17Initial program 88.3%
associate--l+88.3%
distribute-lft-out--88.4%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 72.2%
Taylor expanded in d3 around 0 69.6%
Final simplification72.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -7.5e+122) (* d1 (- d2 d3)) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -7.5e+122) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - (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 <= (-7.5d+122)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - (d1 + d3))
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -7.5e+122) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -7.5e+122: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -7.5e+122) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -7.5e+122) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -7.5e+122], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -7.5 \cdot 10^{+122}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -7.5000000000000002e122Initial program 84.6%
associate--l+84.6%
distribute-lft-out--84.6%
distribute-rgt-out--84.6%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 90.2%
Taylor expanded in d1 around 0 79.9%
if -7.5000000000000002e122 < d2 Initial program 90.3%
associate--l+90.3%
distribute-lft-out--90.3%
distribute-rgt-out--93.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.6%
Final simplification84.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.8e+32) (* d1 (- (+ d2 d4) d3)) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.8e+32) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * (d4 - (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.8d+32)) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * (d4 - (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.8e+32) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.8e+32: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.8e+32) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.8e+32) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.8e+32], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.8 \cdot 10^{+32}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -1.7999999999999998e32Initial program 85.0%
associate--l+85.0%
distribute-lft-out--85.0%
distribute-rgt-out--86.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d1 around 0 90.6%
if -1.7999999999999998e32 < d2 Initial program 90.8%
associate--l+90.8%
distribute-lft-out--90.8%
distribute-rgt-out--93.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 86.5%
Final simplification87.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.05e-35) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.05e-35) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 1.05d-35) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.05e-35) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.05e-35: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.05e-35) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.05e-35) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.05e-35], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.05 \cdot 10^{-35}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.05e-35Initial program 90.0%
associate--l+90.0%
distribute-lft-out--90.0%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.5%
if 1.05e-35 < d4 Initial program 88.0%
associate--l+88.0%
distribute-lft-out--88.0%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 46.0%
Final simplification35.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d4))
double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
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
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d4;
}
def code(d1, d2, d3, d4): return d1 * d4
function code(d1, d2, d3, d4) return Float64(d1 * d4) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d4; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d4), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d4
\end{array}
Initial program 89.4%
associate--l+89.4%
distribute-lft-out--89.4%
distribute-rgt-out--92.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 28.0%
Final simplification28.0%
(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 2023195
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:herbie-target
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))