
(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 (- d4 d1)) d3)))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 + (d4 - d1)) - d3);
}
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 + (d4 - d1)) - d3)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 + (d4 - d1)) - d3);
}
def code(d1, d2, d3, d4): return d1 * ((d2 + (d4 - d1)) - d3)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 + Float64(d4 - d1)) - d3)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 + (d4 - d1)) - d3); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 + N[(d4 - d1), $MachinePrecision]), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 + \left(d4 - d1\right)\right) - d3\right)
\end{array}
Initial program 84.4%
+-commutative84.4%
*-commutative84.4%
distribute-lft-out--85.9%
distribute-lft-out89.0%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d1 (- d3))) (t_2 (* d1 (+ d2 d4))))
(if (<= d3 -5.9e+141)
t_1
(if (<= d3 -9e+65)
t_2
(if (<= d3 -3.2e-47)
t_0
(if (<= d3 1.1e+38)
t_2
(if (<= d3 7e+110) t_0 (if (<= d3 3.05e+172) t_2 t_1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -5.9e+141) {
tmp = t_1;
} else if (d3 <= -9e+65) {
tmp = t_2;
} else if (d3 <= -3.2e-47) {
tmp = t_0;
} else if (d3 <= 1.1e+38) {
tmp = t_2;
} else if (d3 <= 7e+110) {
tmp = t_0;
} else if (d3 <= 3.05e+172) {
tmp = t_2;
} 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) :: tmp
t_0 = d1 * -d1
t_1 = d1 * -d3
t_2 = d1 * (d2 + d4)
if (d3 <= (-5.9d+141)) then
tmp = t_1
else if (d3 <= (-9d+65)) then
tmp = t_2
else if (d3 <= (-3.2d-47)) then
tmp = t_0
else if (d3 <= 1.1d+38) then
tmp = t_2
else if (d3 <= 7d+110) then
tmp = t_0
else if (d3 <= 3.05d+172) then
tmp = t_2
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 * -d1;
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -5.9e+141) {
tmp = t_1;
} else if (d3 <= -9e+65) {
tmp = t_2;
} else if (d3 <= -3.2e-47) {
tmp = t_0;
} else if (d3 <= 1.1e+38) {
tmp = t_2;
} else if (d3 <= 7e+110) {
tmp = t_0;
} else if (d3 <= 3.05e+172) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = d1 * -d3 t_2 = d1 * (d2 + d4) tmp = 0 if d3 <= -5.9e+141: tmp = t_1 elif d3 <= -9e+65: tmp = t_2 elif d3 <= -3.2e-47: tmp = t_0 elif d3 <= 1.1e+38: tmp = t_2 elif d3 <= 7e+110: tmp = t_0 elif d3 <= 3.05e+172: tmp = t_2 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d1 * Float64(-d3)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -5.9e+141) tmp = t_1; elseif (d3 <= -9e+65) tmp = t_2; elseif (d3 <= -3.2e-47) tmp = t_0; elseif (d3 <= 1.1e+38) tmp = t_2; elseif (d3 <= 7e+110) tmp = t_0; elseif (d3 <= 3.05e+172) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = d1 * -d3; t_2 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -5.9e+141) tmp = t_1; elseif (d3 <= -9e+65) tmp = t_2; elseif (d3 <= -3.2e-47) tmp = t_0; elseif (d3 <= 1.1e+38) tmp = t_2; elseif (d3 <= 7e+110) tmp = t_0; elseif (d3 <= 3.05e+172) tmp = t_2; else tmp = t_1; 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]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -5.9e+141], t$95$1, If[LessEqual[d3, -9e+65], t$95$2, If[LessEqual[d3, -3.2e-47], t$95$0, If[LessEqual[d3, 1.1e+38], t$95$2, If[LessEqual[d3, 7e+110], t$95$0, If[LessEqual[d3, 3.05e+172], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -5.9 \cdot 10^{+141}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -9 \cdot 10^{+65}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq -3.2 \cdot 10^{-47}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 1.1 \cdot 10^{+38}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 7 \cdot 10^{+110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 3.05 \cdot 10^{+172}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d3 < -5.90000000000000029e141 or 3.0499999999999999e172 < d3 Initial program 81.5%
+-commutative81.5%
*-commutative81.5%
distribute-lft-out--84.6%
distribute-lft-out89.2%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d3 around inf 81.7%
associate-*r*81.7%
neg-mul-181.7%
Simplified81.7%
if -5.90000000000000029e141 < d3 < -9e65 or -3.1999999999999999e-47 < d3 < 1.10000000000000003e38 or 6.9999999999999998e110 < d3 < 3.0499999999999999e172Initial program 87.4%
+-commutative87.4%
*-commutative87.4%
distribute-lft-out--88.0%
distribute-lft-out91.2%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.4%
Taylor expanded in d1 around 0 70.2%
if -9e65 < d3 < -3.1999999999999999e-47 or 1.10000000000000003e38 < d3 < 6.9999999999999998e110Initial program 75.0%
+-commutative75.0%
*-commutative75.0%
distribute-lft-out--78.1%
distribute-lft-out78.1%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around 0 87.7%
+-commutative87.7%
associate--r+87.7%
Simplified87.7%
Taylor expanded in d1 around inf 72.7%
mul-1-neg72.7%
Simplified72.7%
Final simplification73.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (+ d2 d4))) (t_1 (* d1 (- d2 d3))) (t_2 (* d1 (- d2 d1))))
(if (<= d3 -1e+144)
t_1
(if (<= d3 -3.8e+94)
t_0
(if (<= d3 -2.8e+54)
t_1
(if (<= d3 2.5e-28)
t_2
(if (<= d3 8e+35) t_0 (if (<= d3 3.6e+111) t_2 t_1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 + d4);
double t_1 = d1 * (d2 - d3);
double t_2 = d1 * (d2 - d1);
double tmp;
if (d3 <= -1e+144) {
tmp = t_1;
} else if (d3 <= -3.8e+94) {
tmp = t_0;
} else if (d3 <= -2.8e+54) {
tmp = t_1;
} else if (d3 <= 2.5e-28) {
tmp = t_2;
} else if (d3 <= 8e+35) {
tmp = t_0;
} else if (d3 <= 3.6e+111) {
tmp = t_2;
} 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) :: tmp
t_0 = d1 * (d2 + d4)
t_1 = d1 * (d2 - d3)
t_2 = d1 * (d2 - d1)
if (d3 <= (-1d+144)) then
tmp = t_1
else if (d3 <= (-3.8d+94)) then
tmp = t_0
else if (d3 <= (-2.8d+54)) then
tmp = t_1
else if (d3 <= 2.5d-28) then
tmp = t_2
else if (d3 <= 8d+35) then
tmp = t_0
else if (d3 <= 3.6d+111) then
tmp = t_2
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 * (d2 - d3);
double t_2 = d1 * (d2 - d1);
double tmp;
if (d3 <= -1e+144) {
tmp = t_1;
} else if (d3 <= -3.8e+94) {
tmp = t_0;
} else if (d3 <= -2.8e+54) {
tmp = t_1;
} else if (d3 <= 2.5e-28) {
tmp = t_2;
} else if (d3 <= 8e+35) {
tmp = t_0;
} else if (d3 <= 3.6e+111) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 + d4) t_1 = d1 * (d2 - d3) t_2 = d1 * (d2 - d1) tmp = 0 if d3 <= -1e+144: tmp = t_1 elif d3 <= -3.8e+94: tmp = t_0 elif d3 <= -2.8e+54: tmp = t_1 elif d3 <= 2.5e-28: tmp = t_2 elif d3 <= 8e+35: tmp = t_0 elif d3 <= 3.6e+111: tmp = t_2 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 + d4)) t_1 = Float64(d1 * Float64(d2 - d3)) t_2 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d3 <= -1e+144) tmp = t_1; elseif (d3 <= -3.8e+94) tmp = t_0; elseif (d3 <= -2.8e+54) tmp = t_1; elseif (d3 <= 2.5e-28) tmp = t_2; elseif (d3 <= 8e+35) tmp = t_0; elseif (d3 <= 3.6e+111) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 + d4); t_1 = d1 * (d2 - d3); t_2 = d1 * (d2 - d1); tmp = 0.0; if (d3 <= -1e+144) tmp = t_1; elseif (d3 <= -3.8e+94) tmp = t_0; elseif (d3 <= -2.8e+54) tmp = t_1; elseif (d3 <= 2.5e-28) tmp = t_2; elseif (d3 <= 8e+35) tmp = t_0; elseif (d3 <= 3.6e+111) tmp = t_2; 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 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1e+144], t$95$1, If[LessEqual[d3, -3.8e+94], t$95$0, If[LessEqual[d3, -2.8e+54], t$95$1, If[LessEqual[d3, 2.5e-28], t$95$2, If[LessEqual[d3, 8e+35], t$95$0, If[LessEqual[d3, 3.6e+111], t$95$2, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 + d4\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
t_2 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d3 \leq -1 \cdot 10^{+144}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -3.8 \cdot 10^{+94}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -2.8 \cdot 10^{+54}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 2.5 \cdot 10^{-28}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 8 \cdot 10^{+35}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 3.6 \cdot 10^{+111}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d3 < -1.00000000000000002e144 or -3.7999999999999996e94 < d3 < -2.80000000000000015e54 or 3.6000000000000002e111 < d3 Initial program 83.3%
+-commutative83.3%
*-commutative83.3%
distribute-lft-out--85.7%
distribute-lft-out89.2%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 91.0%
+-commutative91.0%
associate--r+91.0%
Simplified91.0%
Taylor expanded in d1 around 0 88.1%
if -1.00000000000000002e144 < d3 < -3.7999999999999996e94 or 2.5000000000000001e-28 < d3 < 7.9999999999999997e35Initial program 80.0%
+-commutative80.0%
*-commutative80.0%
distribute-lft-out--83.3%
distribute-lft-out83.3%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d3 around 0 90.4%
Taylor expanded in d1 around 0 80.7%
if -2.80000000000000015e54 < d3 < 2.5000000000000001e-28 or 7.9999999999999997e35 < d3 < 3.6000000000000002e111Initial program 85.9%
+-commutative85.9%
*-commutative85.9%
distribute-lft-out--86.6%
distribute-lft-out90.1%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around 0 75.6%
+-commutative75.6%
associate--r+75.6%
Simplified75.6%
Taylor expanded in d3 around 0 71.9%
Final simplification78.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d3))) (t_2 (* d1 (+ d2 d4))))
(if (<= d3 -2.9e+143)
t_1
(if (<= d3 -1.45e+74)
t_2
(if (<= d3 3.6e-28)
t_0
(if (<= d3 7.4e+37) t_2 (if (<= d3 3.6e+132) t_0 t_1)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -2.9e+143) {
tmp = t_1;
} else if (d3 <= -1.45e+74) {
tmp = t_2;
} else if (d3 <= 3.6e-28) {
tmp = t_0;
} else if (d3 <= 7.4e+37) {
tmp = t_2;
} else if (d3 <= 3.6e+132) {
tmp = t_0;
} 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) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * -d3
t_2 = d1 * (d2 + d4)
if (d3 <= (-2.9d+143)) then
tmp = t_1
else if (d3 <= (-1.45d+74)) then
tmp = t_2
else if (d3 <= 3.6d-28) then
tmp = t_0
else if (d3 <= 7.4d+37) then
tmp = t_2
else if (d3 <= 3.6d+132) then
tmp = t_0
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 - d1);
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 + d4);
double tmp;
if (d3 <= -2.9e+143) {
tmp = t_1;
} else if (d3 <= -1.45e+74) {
tmp = t_2;
} else if (d3 <= 3.6e-28) {
tmp = t_0;
} else if (d3 <= 7.4e+37) {
tmp = t_2;
} else if (d3 <= 3.6e+132) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * -d3 t_2 = d1 * (d2 + d4) tmp = 0 if d3 <= -2.9e+143: tmp = t_1 elif d3 <= -1.45e+74: tmp = t_2 elif d3 <= 3.6e-28: tmp = t_0 elif d3 <= 7.4e+37: tmp = t_2 elif d3 <= 3.6e+132: tmp = t_0 else: tmp = t_1 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(-d3)) t_2 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -2.9e+143) tmp = t_1; elseif (d3 <= -1.45e+74) tmp = t_2; elseif (d3 <= 3.6e-28) tmp = t_0; elseif (d3 <= 7.4e+37) tmp = t_2; elseif (d3 <= 3.6e+132) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * -d3; t_2 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -2.9e+143) tmp = t_1; elseif (d3 <= -1.45e+74) tmp = t_2; elseif (d3 <= 3.6e-28) tmp = t_0; elseif (d3 <= 7.4e+37) tmp = t_2; elseif (d3 <= 3.6e+132) tmp = t_0; else tmp = t_1; 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]}, Block[{t$95$2 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -2.9e+143], t$95$1, If[LessEqual[d3, -1.45e+74], t$95$2, If[LessEqual[d3, 3.6e-28], t$95$0, If[LessEqual[d3, 7.4e+37], t$95$2, If[LessEqual[d3, 3.6e+132], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
t_2 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -2.9 \cdot 10^{+143}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -1.45 \cdot 10^{+74}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 3.6 \cdot 10^{-28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 7.4 \cdot 10^{+37}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d3 \leq 3.6 \cdot 10^{+132}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if d3 < -2.8999999999999998e143 or 3.60000000000000016e132 < d3 Initial program 84.0%
+-commutative84.0%
*-commutative84.0%
distribute-lft-out--86.6%
distribute-lft-out90.6%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d3 around inf 76.9%
associate-*r*76.9%
neg-mul-176.9%
Simplified76.9%
if -2.8999999999999998e143 < d3 < -1.4500000000000001e74 or 3.5999999999999999e-28 < d3 < 7.3999999999999999e37Initial program 82.4%
+-commutative82.4%
*-commutative82.4%
distribute-lft-out--85.3%
distribute-lft-out85.3%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d3 around 0 85.8%
Taylor expanded in d1 around 0 77.3%
if -1.4500000000000001e74 < d3 < 3.5999999999999999e-28 or 7.3999999999999999e37 < d3 < 3.60000000000000016e132Initial program 85.0%
+-commutative85.0%
*-commutative85.0%
distribute-lft-out--85.7%
distribute-lft-out89.1%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around 0 75.1%
+-commutative75.1%
associate--r+75.1%
Simplified75.1%
Taylor expanded in d3 around 0 70.9%
Final simplification73.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))) (t_1 (* d1 (- d4 d1))))
(if (<= d3 -8.5e+107)
t_0
(if (<= d3 -2.5e+95)
t_1
(if (<= d3 -4.5e+54)
t_0
(if (<= d3 1.22e-107)
(* d1 (- d2 d1))
(if (<= d3 5.6e+172) t_1 t_0)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 - d1);
double tmp;
if (d3 <= -8.5e+107) {
tmp = t_0;
} else if (d3 <= -2.5e+95) {
tmp = t_1;
} else if (d3 <= -4.5e+54) {
tmp = t_0;
} else if (d3 <= 1.22e-107) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 5.6e+172) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d3)
t_1 = d1 * (d4 - d1)
if (d3 <= (-8.5d+107)) then
tmp = t_0
else if (d3 <= (-2.5d+95)) then
tmp = t_1
else if (d3 <= (-4.5d+54)) then
tmp = t_0
else if (d3 <= 1.22d-107) then
tmp = d1 * (d2 - d1)
else if (d3 <= 5.6d+172) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double t_1 = d1 * (d4 - d1);
double tmp;
if (d3 <= -8.5e+107) {
tmp = t_0;
} else if (d3 <= -2.5e+95) {
tmp = t_1;
} else if (d3 <= -4.5e+54) {
tmp = t_0;
} else if (d3 <= 1.22e-107) {
tmp = d1 * (d2 - d1);
} else if (d3 <= 5.6e+172) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) t_1 = d1 * (d4 - d1) tmp = 0 if d3 <= -8.5e+107: tmp = t_0 elif d3 <= -2.5e+95: tmp = t_1 elif d3 <= -4.5e+54: tmp = t_0 elif d3 <= 1.22e-107: tmp = d1 * (d2 - d1) elif d3 <= 5.6e+172: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) t_1 = Float64(d1 * Float64(d4 - d1)) tmp = 0.0 if (d3 <= -8.5e+107) tmp = t_0; elseif (d3 <= -2.5e+95) tmp = t_1; elseif (d3 <= -4.5e+54) tmp = t_0; elseif (d3 <= 1.22e-107) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d3 <= 5.6e+172) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); t_1 = d1 * (d4 - d1); tmp = 0.0; if (d3 <= -8.5e+107) tmp = t_0; elseif (d3 <= -2.5e+95) tmp = t_1; elseif (d3 <= -4.5e+54) tmp = t_0; elseif (d3 <= 1.22e-107) tmp = d1 * (d2 - d1); elseif (d3 <= 5.6e+172) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -8.5e+107], t$95$0, If[LessEqual[d3, -2.5e+95], t$95$1, If[LessEqual[d3, -4.5e+54], t$95$0, If[LessEqual[d3, 1.22e-107], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 5.6e+172], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d4 - d1\right)\\
\mathbf{if}\;d3 \leq -8.5 \cdot 10^{+107}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -2.5 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -4.5 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 1.22 \cdot 10^{-107}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 5.6 \cdot 10^{+172}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -8.4999999999999999e107 or -2.50000000000000012e95 < d3 < -4.49999999999999984e54 or 5.5999999999999999e172 < d3 Initial program 81.2%
+-commutative81.2%
*-commutative81.2%
distribute-lft-out--85.0%
distribute-lft-out88.7%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 89.4%
+-commutative89.4%
associate--r+89.4%
Simplified89.4%
Taylor expanded in d1 around 0 85.1%
if -8.4999999999999999e107 < d3 < -2.50000000000000012e95 or 1.22000000000000001e-107 < d3 < 5.5999999999999999e172Initial program 84.1%
+-commutative84.1%
*-commutative84.1%
distribute-lft-out--85.7%
distribute-lft-out85.7%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d2 around 0 76.1%
associate--r+76.1%
Simplified76.1%
Taylor expanded in d3 around 0 60.4%
if -4.49999999999999984e54 < d3 < 1.22000000000000001e-107Initial program 86.7%
+-commutative86.7%
*-commutative86.7%
distribute-lft-out--86.7%
distribute-lft-out91.1%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around 0 74.5%
+-commutative74.5%
associate--r+74.5%
Simplified74.5%
Taylor expanded in d3 around 0 73.1%
Final simplification73.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d1 (- d3))))
(if (<= d2 -2.95e+46)
(* d1 d2)
(if (<= d2 -6.2e-52)
t_1
(if (<= d2 -4e-243)
t_0
(if (<= d2 -8.5e-279) t_1 (if (<= d2 1.25e-168) 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 (d2 <= -2.95e+46) {
tmp = d1 * d2;
} else if (d2 <= -6.2e-52) {
tmp = t_1;
} else if (d2 <= -4e-243) {
tmp = t_0;
} else if (d2 <= -8.5e-279) {
tmp = t_1;
} else if (d2 <= 1.25e-168) {
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 (d2 <= (-2.95d+46)) then
tmp = d1 * d2
else if (d2 <= (-6.2d-52)) then
tmp = t_1
else if (d2 <= (-4d-243)) then
tmp = t_0
else if (d2 <= (-8.5d-279)) then
tmp = t_1
else if (d2 <= 1.25d-168) 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 (d2 <= -2.95e+46) {
tmp = d1 * d2;
} else if (d2 <= -6.2e-52) {
tmp = t_1;
} else if (d2 <= -4e-243) {
tmp = t_0;
} else if (d2 <= -8.5e-279) {
tmp = t_1;
} else if (d2 <= 1.25e-168) {
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 d2 <= -2.95e+46: tmp = d1 * d2 elif d2 <= -6.2e-52: tmp = t_1 elif d2 <= -4e-243: tmp = t_0 elif d2 <= -8.5e-279: tmp = t_1 elif d2 <= 1.25e-168: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d2 <= -2.95e+46) tmp = Float64(d1 * d2); elseif (d2 <= -6.2e-52) tmp = t_1; elseif (d2 <= -4e-243) tmp = t_0; elseif (d2 <= -8.5e-279) tmp = t_1; elseif (d2 <= 1.25e-168) 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 (d2 <= -2.95e+46) tmp = d1 * d2; elseif (d2 <= -6.2e-52) tmp = t_1; elseif (d2 <= -4e-243) tmp = t_0; elseif (d2 <= -8.5e-279) tmp = t_1; elseif (d2 <= 1.25e-168) 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[d2, -2.95e+46], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, -6.2e-52], t$95$1, If[LessEqual[d2, -4e-243], t$95$0, If[LessEqual[d2, -8.5e-279], t$95$1, If[LessEqual[d2, 1.25e-168], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d2 \leq -2.95 \cdot 10^{+46}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -6.2 \cdot 10^{-52}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -4 \cdot 10^{-243}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -8.5 \cdot 10^{-279}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq 1.25 \cdot 10^{-168}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -2.95e46Initial program 75.4%
+-commutative75.4%
*-commutative75.4%
distribute-lft-out--79.2%
distribute-lft-out84.8%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d2 around inf 64.3%
if -2.95e46 < d2 < -6.1999999999999998e-52 or -3.99999999999999998e-243 < d2 < -8.5000000000000002e-279Initial program 83.3%
+-commutative83.3%
*-commutative83.3%
distribute-lft-out--83.3%
distribute-lft-out83.3%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d3 around inf 35.0%
associate-*r*35.0%
neg-mul-135.0%
Simplified35.0%
if -6.1999999999999998e-52 < d2 < -3.99999999999999998e-243 or -8.5000000000000002e-279 < d2 < 1.25e-168Initial program 96.0%
+-commutative96.0%
*-commutative96.0%
distribute-lft-out--96.0%
distribute-lft-out96.0%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 72.5%
+-commutative72.5%
associate--r+72.5%
Simplified72.5%
Taylor expanded in d1 around inf 42.4%
mul-1-neg42.4%
Simplified42.4%
if 1.25e-168 < d2 Initial program 80.7%
+-commutative80.7%
*-commutative80.7%
distribute-lft-out--82.6%
distribute-lft-out87.1%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around inf 25.4%
Final simplification39.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 -2.8e-207)
t_0
(if (<= d4 1.5e-280)
(* d1 (- d2 d3))
(if (<= d4 4.8e-30) t_0 (* d1 (- d4 d3)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= -2.8e-207) {
tmp = t_0;
} else if (d4 <= 1.5e-280) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 4.8e-30) {
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 - d1)
if (d4 <= (-2.8d-207)) then
tmp = t_0
else if (d4 <= 1.5d-280) then
tmp = d1 * (d2 - d3)
else if (d4 <= 4.8d-30) 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 - d1);
double tmp;
if (d4 <= -2.8e-207) {
tmp = t_0;
} else if (d4 <= 1.5e-280) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 4.8e-30) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= -2.8e-207: tmp = t_0 elif d4 <= 1.5e-280: tmp = d1 * (d2 - d3) elif d4 <= 4.8e-30: tmp = t_0 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= -2.8e-207) tmp = t_0; elseif (d4 <= 1.5e-280) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 4.8e-30) 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 - d1); tmp = 0.0; if (d4 <= -2.8e-207) tmp = t_0; elseif (d4 <= 1.5e-280) tmp = d1 * (d2 - d3); elseif (d4 <= 4.8e-30) 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 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, -2.8e-207], t$95$0, If[LessEqual[d4, 1.5e-280], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 4.8e-30], t$95$0, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq -2.8 \cdot 10^{-207}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.5 \cdot 10^{-280}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 4.8 \cdot 10^{-30}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < -2.79999999999999993e-207 or 1.49999999999999994e-280 < d4 < 4.7999999999999997e-30Initial program 84.9%
+-commutative84.9%
*-commutative84.9%
distribute-lft-out--87.4%
distribute-lft-out89.3%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.4%
+-commutative82.4%
associate--r+82.4%
Simplified82.4%
Taylor expanded in d3 around 0 61.1%
if -2.79999999999999993e-207 < d4 < 1.49999999999999994e-280Initial program 92.6%
+-commutative92.6%
*-commutative92.6%
distribute-lft-out--92.6%
distribute-lft-out92.6%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 99.9%
+-commutative99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in d1 around 0 59.6%
if 4.7999999999999997e-30 < d4 Initial program 80.0%
+-commutative80.0%
*-commutative80.0%
distribute-lft-out--80.0%
distribute-lft-out87.1%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d2 around 0 88.4%
associate--r+88.4%
Simplified88.4%
Taylor expanded in d1 around 0 73.7%
Final simplification64.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -2.8e+143) (* d1 (- d2 d3)) (if (<= d3 2.5e+111) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.8e+143) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 2.5e+111) {
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 <= (-2.8d+143)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 2.5d+111) 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 <= -2.8e+143) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 2.5e+111) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -2.8e+143: tmp = d1 * (d2 - d3) elif d3 <= 2.5e+111: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -2.8e+143) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 2.5e+111) 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 <= -2.8e+143) tmp = d1 * (d2 - d3); elseif (d3 <= 2.5e+111) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -2.8e+143], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.5e+111], 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 -2.8 \cdot 10^{+143}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 2.5 \cdot 10^{+111}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -2.79999999999999998e143Initial program 83.8%
+-commutative83.8%
*-commutative83.8%
distribute-lft-out--87.0%
distribute-lft-out87.0%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 96.9%
+-commutative96.9%
associate--r+96.9%
Simplified96.9%
Taylor expanded in d1 around 0 89.2%
if -2.79999999999999998e143 < d3 < 2.4999999999999998e111Initial program 85.4%
+-commutative85.4%
*-commutative85.4%
distribute-lft-out--86.5%
distribute-lft-out89.3%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.3%
if 2.4999999999999998e111 < d3 Initial program 80.9%
+-commutative80.9%
*-commutative80.9%
distribute-lft-out--83.0%
distribute-lft-out89.3%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d2 around 0 86.5%
associate--r+86.5%
Simplified86.5%
Taylor expanded in d1 around 0 84.3%
Final simplification91.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -4.7e+141) (* d1 (- (- d2 d3) d1)) (if (<= d3 2.35e+113) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -4.7e+141) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d3 <= 2.35e+113) {
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.7d+141)) then
tmp = d1 * ((d2 - d3) - d1)
else if (d3 <= 2.35d+113) 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.7e+141) {
tmp = d1 * ((d2 - d3) - d1);
} else if (d3 <= 2.35e+113) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -4.7e+141: tmp = d1 * ((d2 - d3) - d1) elif d3 <= 2.35e+113: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -4.7e+141) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); elseif (d3 <= 2.35e+113) 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.7e+141) tmp = d1 * ((d2 - d3) - d1); elseif (d3 <= 2.35e+113) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -4.7e+141], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 2.35e+113], 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.7 \cdot 10^{+141}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{elif}\;d3 \leq 2.35 \cdot 10^{+113}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -4.69999999999999979e141Initial program 83.8%
+-commutative83.8%
*-commutative83.8%
distribute-lft-out--87.0%
distribute-lft-out87.0%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 96.9%
+-commutative96.9%
associate--r+96.9%
Simplified96.9%
if -4.69999999999999979e141 < d3 < 2.3499999999999999e113Initial program 85.4%
+-commutative85.4%
*-commutative85.4%
distribute-lft-out--86.5%
distribute-lft-out89.3%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.3%
if 2.3499999999999999e113 < d3 Initial program 80.9%
+-commutative80.9%
*-commutative80.9%
distribute-lft-out--83.0%
distribute-lft-out89.3%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d2 around 0 86.5%
associate--r+86.5%
Simplified86.5%
Taylor expanded in d1 around 0 84.3%
Final simplification92.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.7e-17) (* d1 (- d2 d3)) (if (<= d2 3.5e-173) (* d1 (- (- d3) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.7e-17) {
tmp = d1 * (d2 - d3);
} else if (d2 <= 3.5e-173) {
tmp = d1 * (-d3 - 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 (d2 <= (-1.7d-17)) then
tmp = d1 * (d2 - d3)
else if (d2 <= 3.5d-173) then
tmp = d1 * (-d3 - 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 (d2 <= -1.7e-17) {
tmp = d1 * (d2 - d3);
} else if (d2 <= 3.5e-173) {
tmp = d1 * (-d3 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.7e-17: tmp = d1 * (d2 - d3) elif d2 <= 3.5e-173: tmp = d1 * (-d3 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.7e-17) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= 3.5e-173) tmp = Float64(d1 * Float64(Float64(-d3) - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.7e-17) tmp = d1 * (d2 - d3); elseif (d2 <= 3.5e-173) tmp = d1 * (-d3 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.7e-17], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, 3.5e-173], N[(d1 * N[((-d3) - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.7 \cdot 10^{-17}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq 3.5 \cdot 10^{-173}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -1.6999999999999999e-17Initial program 76.2%
+-commutative76.2%
*-commutative76.2%
distribute-lft-out--79.6%
distribute-lft-out84.7%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 88.1%
+-commutative88.1%
associate--r+88.1%
Simplified88.1%
Taylor expanded in d1 around 0 73.8%
if -1.6999999999999999e-17 < d2 < 3.50000000000000014e-173Initial program 94.0%
+-commutative94.0%
*-commutative94.0%
distribute-lft-out--94.0%
distribute-lft-out94.0%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 70.5%
+-commutative70.5%
associate--r+70.5%
Simplified70.5%
Taylor expanded in d2 around 0 68.3%
mul-1-neg68.3%
distribute-rgt-neg-in68.3%
distribute-neg-in68.3%
+-commutative68.3%
sub-neg68.3%
Simplified68.3%
if 3.50000000000000014e-173 < d2 Initial program 81.4%
+-commutative81.4%
*-commutative81.4%
distribute-lft-out--83.2%
distribute-lft-out87.6%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d2 around 0 77.3%
associate--r+77.3%
Simplified77.3%
Taylor expanded in d1 around 0 51.7%
Final simplification62.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 6.4e-35) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d1) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6.4e-35) {
tmp = d1 * ((d2 - d3) - d1);
} 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 (d4 <= 6.4d-35) then
tmp = d1 * ((d2 - d3) - d1)
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 (d4 <= 6.4e-35) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 6.4e-35: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 6.4e-35) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(d4 - d1) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 6.4e-35) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 6.4e-35], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 6.4 \cdot 10^{-35}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 6.3999999999999996e-35Initial program 86.0%
+-commutative86.0%
*-commutative86.0%
distribute-lft-out--88.1%
distribute-lft-out89.8%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.9%
+-commutative84.9%
associate--r+84.9%
Simplified84.9%
if 6.3999999999999996e-35 < d4 Initial program 80.0%
+-commutative80.0%
*-commutative80.0%
distribute-lft-out--80.0%
distribute-lft-out87.1%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d2 around 0 88.4%
associate--r+88.4%
Simplified88.4%
Final simplification85.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.7e-17) (* d1 d2) (if (<= d2 5.6e-167) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.7e-17) {
tmp = d1 * d2;
} else if (d2 <= 5.6e-167) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.7d-17)) then
tmp = d1 * d2
else if (d2 <= 5.6d-167) then
tmp = d1 * -d1
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.7e-17) {
tmp = d1 * d2;
} else if (d2 <= 5.6e-167) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.7e-17: tmp = d1 * d2 elif d2 <= 5.6e-167: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.7e-17) tmp = Float64(d1 * d2); elseif (d2 <= 5.6e-167) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.7e-17) tmp = d1 * d2; elseif (d2 <= 5.6e-167) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.7e-17], N[(d1 * d2), $MachinePrecision], If[LessEqual[d2, 5.6e-167], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.7 \cdot 10^{-17}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq 5.6 \cdot 10^{-167}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.6999999999999999e-17Initial program 76.2%
+-commutative76.2%
*-commutative76.2%
distribute-lft-out--79.6%
distribute-lft-out84.7%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d2 around inf 61.6%
if -1.6999999999999999e-17 < d2 < 5.59999999999999971e-167Initial program 94.3%
+-commutative94.3%
*-commutative94.3%
distribute-lft-out--94.3%
distribute-lft-out94.3%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d4 around 0 71.9%
+-commutative71.9%
associate--r+71.9%
Simplified71.9%
Taylor expanded in d1 around inf 38.3%
mul-1-neg38.3%
Simplified38.3%
if 5.59999999999999971e-167 < d2 Initial program 80.7%
+-commutative80.7%
*-commutative80.7%
distribute-lft-out--82.6%
distribute-lft-out87.1%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around inf 25.4%
Final simplification38.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1.4e-33) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.4e-33) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-1.4d-33)) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1.4e-33) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1.4e-33: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1.4e-33) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -1.4e-33) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1.4e-33], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1.4 \cdot 10^{-33}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.4e-33Initial program 76.6%
+-commutative76.6%
*-commutative76.6%
distribute-lft-out--80.0%
distribute-lft-out84.9%
distribute-lft-out--99.9%
+-commutative99.9%
associate-+l-99.9%
associate--l-99.9%
associate--r-99.9%
sub-neg99.9%
sub-neg99.9%
+-commutative99.9%
distribute-neg-out99.9%
remove-double-neg99.9%
sub-neg99.9%
+-commutative99.9%
associate--l-99.9%
Simplified99.9%
Taylor expanded in d2 around inf 62.3%
if -1.4e-33 < d2 Initial program 86.7%
+-commutative86.7%
*-commutative86.7%
distribute-lft-out--87.7%
distribute-lft-out90.3%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d4 around inf 30.7%
Final simplification38.1%
(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 84.4%
+-commutative84.4%
*-commutative84.4%
distribute-lft-out--85.9%
distribute-lft-out89.0%
distribute-lft-out--100.0%
+-commutative100.0%
associate-+l-100.0%
associate--l-100.0%
associate--r-100.0%
sub-neg100.0%
sub-neg100.0%
+-commutative100.0%
distribute-neg-out100.0%
remove-double-neg100.0%
sub-neg100.0%
+-commutative100.0%
associate--l-100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.5%
Final simplification31.5%
(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 2023305
(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)))