
(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 (- (- d4 d3) (- d1 d2))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - d3) - (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 * ((d4 - d3) - (d1 - d2))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 - d3) - (d1 - d2));
}
def code(d1, d2, d3, d4): return d1 * ((d4 - d3) - (d1 - d2))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d4 - d3) - Float64(d1 - d2))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d4 - d3) - (d1 - d2)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - N[(d1 - d2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d4 - d3\right) - \left(d1 - d2\right)\right)
\end{array}
Initial program 90.6%
sub-neg90.6%
associate-+l+90.6%
*-commutative90.6%
+-commutative90.6%
*-commutative90.6%
sub-neg90.6%
+-commutative90.6%
associate--l+90.6%
distribute-lft-out--91.4%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (- (* d1 d1))))
(if (<= d4 -1.8e-202)
(* d1 d2)
(if (<= d4 8e-231)
t_1
(if (<= d4 4.2e-183)
(* d1 d2)
(if (<= d4 1.5e-141)
t_0
(if (<= d4 3.7e-109)
(* d1 d2)
(if (<= d4 1.95e-82)
t_1
(if (<= d4 3.45e-65)
t_0
(if (<= d4 6.6e-43)
t_1
(if (<= d4 1.4e+95) t_0 (* d1 d4))))))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = -(d1 * d1);
double tmp;
if (d4 <= -1.8e-202) {
tmp = d1 * d2;
} else if (d4 <= 8e-231) {
tmp = t_1;
} else if (d4 <= 4.2e-183) {
tmp = d1 * d2;
} else if (d4 <= 1.5e-141) {
tmp = t_0;
} else if (d4 <= 3.7e-109) {
tmp = d1 * d2;
} else if (d4 <= 1.95e-82) {
tmp = t_1;
} else if (d4 <= 3.45e-65) {
tmp = t_0;
} else if (d4 <= 6.6e-43) {
tmp = t_1;
} else if (d4 <= 1.4e+95) {
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 * -d3
t_1 = -(d1 * d1)
if (d4 <= (-1.8d-202)) then
tmp = d1 * d2
else if (d4 <= 8d-231) then
tmp = t_1
else if (d4 <= 4.2d-183) then
tmp = d1 * d2
else if (d4 <= 1.5d-141) then
tmp = t_0
else if (d4 <= 3.7d-109) then
tmp = d1 * d2
else if (d4 <= 1.95d-82) then
tmp = t_1
else if (d4 <= 3.45d-65) then
tmp = t_0
else if (d4 <= 6.6d-43) then
tmp = t_1
else if (d4 <= 1.4d+95) then
tmp = t_0
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = -(d1 * d1);
double tmp;
if (d4 <= -1.8e-202) {
tmp = d1 * d2;
} else if (d4 <= 8e-231) {
tmp = t_1;
} else if (d4 <= 4.2e-183) {
tmp = d1 * d2;
} else if (d4 <= 1.5e-141) {
tmp = t_0;
} else if (d4 <= 3.7e-109) {
tmp = d1 * d2;
} else if (d4 <= 1.95e-82) {
tmp = t_1;
} else if (d4 <= 3.45e-65) {
tmp = t_0;
} else if (d4 <= 6.6e-43) {
tmp = t_1;
} else if (d4 <= 1.4e+95) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = -(d1 * d1) tmp = 0 if d4 <= -1.8e-202: tmp = d1 * d2 elif d4 <= 8e-231: tmp = t_1 elif d4 <= 4.2e-183: tmp = d1 * d2 elif d4 <= 1.5e-141: tmp = t_0 elif d4 <= 3.7e-109: tmp = d1 * d2 elif d4 <= 1.95e-82: tmp = t_1 elif d4 <= 3.45e-65: tmp = t_0 elif d4 <= 6.6e-43: tmp = t_1 elif d4 <= 1.4e+95: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) t_1 = Float64(-Float64(d1 * d1)) tmp = 0.0 if (d4 <= -1.8e-202) tmp = Float64(d1 * d2); elseif (d4 <= 8e-231) tmp = t_1; elseif (d4 <= 4.2e-183) tmp = Float64(d1 * d2); elseif (d4 <= 1.5e-141) tmp = t_0; elseif (d4 <= 3.7e-109) tmp = Float64(d1 * d2); elseif (d4 <= 1.95e-82) tmp = t_1; elseif (d4 <= 3.45e-65) tmp = t_0; elseif (d4 <= 6.6e-43) tmp = t_1; elseif (d4 <= 1.4e+95) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; t_1 = -(d1 * d1); tmp = 0.0; if (d4 <= -1.8e-202) tmp = d1 * d2; elseif (d4 <= 8e-231) tmp = t_1; elseif (d4 <= 4.2e-183) tmp = d1 * d2; elseif (d4 <= 1.5e-141) tmp = t_0; elseif (d4 <= 3.7e-109) tmp = d1 * d2; elseif (d4 <= 1.95e-82) tmp = t_1; elseif (d4 <= 3.45e-65) tmp = t_0; elseif (d4 <= 6.6e-43) tmp = t_1; elseif (d4 <= 1.4e+95) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$1 = (-N[(d1 * d1), $MachinePrecision])}, If[LessEqual[d4, -1.8e-202], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 8e-231], t$95$1, If[LessEqual[d4, 4.2e-183], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.5e-141], t$95$0, If[LessEqual[d4, 3.7e-109], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.95e-82], t$95$1, If[LessEqual[d4, 3.45e-65], t$95$0, If[LessEqual[d4, 6.6e-43], t$95$1, If[LessEqual[d4, 1.4e+95], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := -d1 \cdot d1\\
\mathbf{if}\;d4 \leq -1.8 \cdot 10^{-202}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 8 \cdot 10^{-231}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{-183}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.5 \cdot 10^{-141}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 3.7 \cdot 10^{-109}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.95 \cdot 10^{-82}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 3.45 \cdot 10^{-65}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 6.6 \cdot 10^{-43}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 1.4 \cdot 10^{+95}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -1.8000000000000001e-202 or 7.9999999999999999e-231 < d4 < 4.2000000000000004e-183 or 1.49999999999999992e-141 < d4 < 3.69999999999999981e-109Initial program 91.7%
sub-neg91.7%
associate-+l+91.7%
*-commutative91.7%
+-commutative91.7%
*-commutative91.7%
sub-neg91.7%
+-commutative91.7%
associate--l+91.7%
distribute-lft-out--91.7%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 34.7%
if -1.8000000000000001e-202 < d4 < 7.9999999999999999e-231 or 3.69999999999999981e-109 < d4 < 1.94999999999999987e-82 or 3.44999999999999996e-65 < d4 < 6.60000000000000031e-43Initial program 89.6%
sub-neg89.6%
associate-+l+89.6%
*-commutative89.6%
+-commutative89.6%
*-commutative89.6%
sub-neg89.6%
+-commutative89.6%
associate--l+89.6%
distribute-lft-out--89.6%
distribute-rgt-out--93.7%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 76.7%
+-commutative76.7%
associate--r+76.7%
Simplified76.7%
Taylor expanded in d1 around inf 36.5%
neg-mul-136.5%
Simplified36.5%
if 4.2000000000000004e-183 < d4 < 1.49999999999999992e-141 or 1.94999999999999987e-82 < d4 < 3.44999999999999996e-65 or 6.60000000000000031e-43 < d4 < 1.3999999999999999e95Initial program 97.6%
sub-neg97.6%
associate-+l+97.6%
*-commutative97.6%
+-commutative97.6%
*-commutative97.6%
sub-neg97.6%
+-commutative97.6%
associate--l+97.6%
distribute-lft-out--97.6%
distribute-rgt-out--97.6%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 45.8%
mul-1-neg45.8%
distribute-rgt-neg-out45.8%
Simplified45.8%
if 1.3999999999999999e95 < d4 Initial program 82.2%
sub-neg82.2%
associate-+l+82.2%
*-commutative82.2%
+-commutative82.2%
*-commutative82.2%
sub-neg82.2%
+-commutative82.2%
associate--l+82.2%
distribute-lft-out--86.6%
distribute-rgt-out--88.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 78.4%
Final simplification44.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (+ d2 d4))))
(if (<= d3 -9.6e+132)
t_0
(if (<= d3 -9.8e-244)
t_1
(if (<= d3 5e-260)
(* d1 (- d4 d1))
(if (<= d3 1e-94) t_1 (if (<= d3 4.4e+166) (* d1 (- d2 d1)) t_0)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d3 <= -9.6e+132) {
tmp = t_0;
} else if (d3 <= -9.8e-244) {
tmp = t_1;
} else if (d3 <= 5e-260) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 1e-94) {
tmp = t_1;
} else if (d3 <= 4.4e+166) {
tmp = d1 * (d2 - 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) :: t_1
real(8) :: tmp
t_0 = d1 * -d3
t_1 = d1 * (d2 + d4)
if (d3 <= (-9.6d+132)) then
tmp = t_0
else if (d3 <= (-9.8d-244)) then
tmp = t_1
else if (d3 <= 5d-260) then
tmp = d1 * (d4 - d1)
else if (d3 <= 1d-94) then
tmp = t_1
else if (d3 <= 4.4d+166) then
tmp = d1 * (d2 - 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 t_1 = d1 * (d2 + d4);
double tmp;
if (d3 <= -9.6e+132) {
tmp = t_0;
} else if (d3 <= -9.8e-244) {
tmp = t_1;
} else if (d3 <= 5e-260) {
tmp = d1 * (d4 - d1);
} else if (d3 <= 1e-94) {
tmp = t_1;
} else if (d3 <= 4.4e+166) {
tmp = d1 * (d2 - d1);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * (d2 + d4) tmp = 0 if d3 <= -9.6e+132: tmp = t_0 elif d3 <= -9.8e-244: tmp = t_1 elif d3 <= 5e-260: tmp = d1 * (d4 - d1) elif d3 <= 1e-94: tmp = t_1 elif d3 <= 4.4e+166: tmp = d1 * (d2 - d1) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) t_1 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -9.6e+132) tmp = t_0; elseif (d3 <= -9.8e-244) tmp = t_1; elseif (d3 <= 5e-260) tmp = Float64(d1 * Float64(d4 - d1)); elseif (d3 <= 1e-94) tmp = t_1; elseif (d3 <= 4.4e+166) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; t_1 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -9.6e+132) tmp = t_0; elseif (d3 <= -9.8e-244) tmp = t_1; elseif (d3 <= 5e-260) tmp = d1 * (d4 - d1); elseif (d3 <= 1e-94) tmp = t_1; elseif (d3 <= 4.4e+166) tmp = d1 * (d2 - d1); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -9.6e+132], t$95$0, If[LessEqual[d3, -9.8e-244], t$95$1, If[LessEqual[d3, 5e-260], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1e-94], t$95$1, If[LessEqual[d3, 4.4e+166], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -9.6 \cdot 10^{+132}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -9.8 \cdot 10^{-244}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 5 \cdot 10^{-260}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d3 \leq 10^{-94}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 4.4 \cdot 10^{+166}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -9.6000000000000004e132 or 4.3999999999999998e166 < d3 Initial program 87.1%
sub-neg87.1%
associate-+l+87.1%
*-commutative87.1%
+-commutative87.1%
*-commutative87.1%
sub-neg87.1%
+-commutative87.1%
associate--l+87.1%
distribute-lft-out--88.5%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 79.7%
mul-1-neg79.7%
distribute-rgt-neg-out79.7%
Simplified79.7%
if -9.6000000000000004e132 < d3 < -9.80000000000000029e-244 or 5.0000000000000003e-260 < d3 < 9.9999999999999996e-95Initial program 93.8%
sub-neg93.8%
associate-+l+93.8%
*-commutative93.8%
+-commutative93.8%
*-commutative93.8%
sub-neg93.8%
+-commutative93.8%
associate--l+93.8%
distribute-lft-out--93.8%
distribute-rgt-out--95.6%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.2%
Taylor expanded in d1 around 0 79.0%
if -9.80000000000000029e-244 < d3 < 5.0000000000000003e-260Initial program 88.9%
sub-neg88.9%
associate-+l+88.9%
*-commutative88.9%
+-commutative88.9%
*-commutative88.9%
sub-neg88.9%
+-commutative88.9%
associate--l+88.9%
distribute-lft-out--88.9%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d2 around 0 89.0%
if 9.9999999999999996e-95 < d3 < 4.3999999999999998e166Initial program 88.8%
sub-neg88.8%
associate-+l+88.8%
*-commutative88.8%
+-commutative88.8%
*-commutative88.8%
sub-neg88.8%
+-commutative88.8%
associate--l+88.8%
distribute-lft-out--90.7%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 86.6%
Taylor expanded in d4 around 0 60.2%
Final simplification75.9%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (+ d2 d4))) (t_1 (* d1 (- (- d1) d3))))
(if (<= d2 -7.6e+109)
t_0
(if (<= d2 -9.2e+89)
t_1
(if (<= d2 -410.0)
t_0
(if (<= d2 -2e-306)
t_1
(if (<= d2 2.4e-94) (* d1 (- d4 d1)) (* d1 (- d4 d3)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 + d4);
double t_1 = d1 * (-d1 - d3);
double tmp;
if (d2 <= -7.6e+109) {
tmp = t_0;
} else if (d2 <= -9.2e+89) {
tmp = t_1;
} else if (d2 <= -410.0) {
tmp = t_0;
} else if (d2 <= -2e-306) {
tmp = t_1;
} else if (d2 <= 2.4e-94) {
tmp = d1 * (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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 + d4)
t_1 = d1 * (-d1 - d3)
if (d2 <= (-7.6d+109)) then
tmp = t_0
else if (d2 <= (-9.2d+89)) then
tmp = t_1
else if (d2 <= (-410.0d0)) then
tmp = t_0
else if (d2 <= (-2d-306)) then
tmp = t_1
else if (d2 <= 2.4d-94) then
tmp = d1 * (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 t_0 = d1 * (d2 + d4);
double t_1 = d1 * (-d1 - d3);
double tmp;
if (d2 <= -7.6e+109) {
tmp = t_0;
} else if (d2 <= -9.2e+89) {
tmp = t_1;
} else if (d2 <= -410.0) {
tmp = t_0;
} else if (d2 <= -2e-306) {
tmp = t_1;
} else if (d2 <= 2.4e-94) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 + d4) t_1 = d1 * (-d1 - d3) tmp = 0 if d2 <= -7.6e+109: tmp = t_0 elif d2 <= -9.2e+89: tmp = t_1 elif d2 <= -410.0: tmp = t_0 elif d2 <= -2e-306: tmp = t_1 elif d2 <= 2.4e-94: tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 + d4)) t_1 = Float64(d1 * Float64(Float64(-d1) - d3)) tmp = 0.0 if (d2 <= -7.6e+109) tmp = t_0; elseif (d2 <= -9.2e+89) tmp = t_1; elseif (d2 <= -410.0) tmp = t_0; elseif (d2 <= -2e-306) tmp = t_1; elseif (d2 <= 2.4e-94) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 + d4); t_1 = d1 * (-d1 - d3); tmp = 0.0; if (d2 <= -7.6e+109) tmp = t_0; elseif (d2 <= -9.2e+89) tmp = t_1; elseif (d2 <= -410.0) tmp = t_0; elseif (d2 <= -2e-306) tmp = t_1; elseif (d2 <= 2.4e-94) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); 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[((-d1) - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -7.6e+109], t$95$0, If[LessEqual[d2, -9.2e+89], t$95$1, If[LessEqual[d2, -410.0], t$95$0, If[LessEqual[d2, -2e-306], t$95$1, If[LessEqual[d2, 2.4e-94], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 + d4\right)\\
t_1 := d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{if}\;d2 \leq -7.6 \cdot 10^{+109}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -9.2 \cdot 10^{+89}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -410:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -2 \cdot 10^{-306}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq 2.4 \cdot 10^{-94}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -7.60000000000000078e109 or -9.1999999999999996e89 < d2 < -410Initial program 89.8%
sub-neg89.8%
associate-+l+89.8%
*-commutative89.8%
+-commutative89.8%
*-commutative89.8%
sub-neg89.8%
+-commutative89.8%
associate--l+89.8%
distribute-lft-out--89.8%
distribute-rgt-out--93.2%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 83.3%
Taylor expanded in d1 around 0 76.7%
if -7.60000000000000078e109 < d2 < -9.1999999999999996e89 or -410 < d2 < -2.00000000000000006e-306Initial program 88.5%
sub-neg88.5%
associate-+l+88.5%
*-commutative88.5%
+-commutative88.5%
*-commutative88.5%
sub-neg88.5%
+-commutative88.5%
associate--l+88.5%
distribute-lft-out--90.1%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 99.9%
+-commutative99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in d4 around 0 72.9%
associate-*r*72.9%
neg-mul-172.9%
Simplified72.9%
if -2.00000000000000006e-306 < d2 < 2.4e-94Initial program 91.1%
sub-neg91.1%
associate-+l+91.1%
*-commutative91.1%
+-commutative91.1%
*-commutative91.1%
sub-neg91.1%
+-commutative91.1%
associate--l+91.1%
distribute-lft-out--91.1%
distribute-rgt-out--91.1%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 84.3%
Taylor expanded in d2 around 0 84.2%
if 2.4e-94 < d2 Initial program 92.3%
sub-neg92.3%
associate-+l+92.3%
*-commutative92.3%
+-commutative92.3%
*-commutative92.3%
sub-neg92.3%
+-commutative92.3%
associate--l+92.3%
distribute-lft-out--93.4%
distribute-rgt-out--95.6%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 72.8%
+-commutative72.8%
associate--r+72.8%
Simplified72.8%
Taylor expanded in d1 around 0 57.8%
Final simplification70.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))) (t_1 (* d1 (+ d2 d4))))
(if (<= d3 -5.6e+132)
t_0
(if (<= d3 4.6e+52)
t_1
(if (<= d3 1.45e+74) (- (* d1 d1)) (if (<= d3 4e+153) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d3 <= -5.6e+132) {
tmp = t_0;
} else if (d3 <= 4.6e+52) {
tmp = t_1;
} else if (d3 <= 1.45e+74) {
tmp = -(d1 * d1);
} else if (d3 <= 4e+153) {
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 * -d3
t_1 = d1 * (d2 + d4)
if (d3 <= (-5.6d+132)) then
tmp = t_0
else if (d3 <= 4.6d+52) then
tmp = t_1
else if (d3 <= 1.45d+74) then
tmp = -(d1 * d1)
else if (d3 <= 4d+153) 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 * -d3;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d3 <= -5.6e+132) {
tmp = t_0;
} else if (d3 <= 4.6e+52) {
tmp = t_1;
} else if (d3 <= 1.45e+74) {
tmp = -(d1 * d1);
} else if (d3 <= 4e+153) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 t_1 = d1 * (d2 + d4) tmp = 0 if d3 <= -5.6e+132: tmp = t_0 elif d3 <= 4.6e+52: tmp = t_1 elif d3 <= 1.45e+74: tmp = -(d1 * d1) elif d3 <= 4e+153: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) t_1 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d3 <= -5.6e+132) tmp = t_0; elseif (d3 <= 4.6e+52) tmp = t_1; elseif (d3 <= 1.45e+74) tmp = Float64(-Float64(d1 * d1)); elseif (d3 <= 4e+153) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; t_1 = d1 * (d2 + d4); tmp = 0.0; if (d3 <= -5.6e+132) tmp = t_0; elseif (d3 <= 4.6e+52) tmp = t_1; elseif (d3 <= 1.45e+74) tmp = -(d1 * d1); elseif (d3 <= 4e+153) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -5.6e+132], t$95$0, If[LessEqual[d3, 4.6e+52], t$95$1, If[LessEqual[d3, 1.45e+74], (-N[(d1 * d1), $MachinePrecision]), If[LessEqual[d3, 4e+153], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -5.6 \cdot 10^{+132}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 4.6 \cdot 10^{+52}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq 1.45 \cdot 10^{+74}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d3 \leq 4 \cdot 10^{+153}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -5.5999999999999998e132 or 4e153 < d3 Initial program 85.3%
sub-neg85.3%
associate-+l+85.3%
*-commutative85.3%
+-commutative85.3%
*-commutative85.3%
sub-neg85.3%
+-commutative85.3%
associate--l+85.3%
distribute-lft-out--86.6%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 77.2%
mul-1-neg77.2%
distribute-rgt-neg-out77.2%
Simplified77.2%
if -5.5999999999999998e132 < d3 < 4.6e52 or 1.4500000000000001e74 < d3 < 4e153Initial program 92.9%
sub-neg92.9%
associate-+l+92.9%
*-commutative92.9%
+-commutative92.9%
*-commutative92.9%
sub-neg92.9%
+-commutative92.9%
associate--l+92.9%
distribute-lft-out--93.5%
distribute-rgt-out--95.3%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.0%
Taylor expanded in d1 around 0 75.6%
if 4.6e52 < d3 < 1.4500000000000001e74Initial program 90.8%
sub-neg90.8%
associate-+l+90.8%
*-commutative90.8%
+-commutative90.8%
*-commutative90.8%
sub-neg90.8%
+-commutative90.8%
associate--l+90.8%
distribute-lft-out--90.8%
distribute-rgt-out--90.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 91.5%
+-commutative91.5%
associate--r+91.5%
Simplified91.5%
Taylor expanded in d1 around inf 59.5%
neg-mul-159.5%
Simplified59.5%
Final simplification75.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (- (* d1 d1))))
(if (<= d4 -9.5e-203)
(* d1 d2)
(if (<= d4 3.4e-231)
t_0
(if (<= d4 3.1e-104) (* d1 d2) (if (<= d4 1.2e+107) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = -(d1 * d1);
double tmp;
if (d4 <= -9.5e-203) {
tmp = d1 * d2;
} else if (d4 <= 3.4e-231) {
tmp = t_0;
} else if (d4 <= 3.1e-104) {
tmp = d1 * d2;
} else if (d4 <= 1.2e+107) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = -(d1 * d1)
if (d4 <= (-9.5d-203)) then
tmp = d1 * d2
else if (d4 <= 3.4d-231) then
tmp = t_0
else if (d4 <= 3.1d-104) then
tmp = d1 * d2
else if (d4 <= 1.2d+107) then
tmp = t_0
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = -(d1 * d1);
double tmp;
if (d4 <= -9.5e-203) {
tmp = d1 * d2;
} else if (d4 <= 3.4e-231) {
tmp = t_0;
} else if (d4 <= 3.1e-104) {
tmp = d1 * d2;
} else if (d4 <= 1.2e+107) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = -(d1 * d1) tmp = 0 if d4 <= -9.5e-203: tmp = d1 * d2 elif d4 <= 3.4e-231: tmp = t_0 elif d4 <= 3.1e-104: tmp = d1 * d2 elif d4 <= 1.2e+107: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(-Float64(d1 * d1)) tmp = 0.0 if (d4 <= -9.5e-203) tmp = Float64(d1 * d2); elseif (d4 <= 3.4e-231) tmp = t_0; elseif (d4 <= 3.1e-104) tmp = Float64(d1 * d2); elseif (d4 <= 1.2e+107) 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 <= -9.5e-203) tmp = d1 * d2; elseif (d4 <= 3.4e-231) tmp = t_0; elseif (d4 <= 3.1e-104) tmp = d1 * d2; elseif (d4 <= 1.2e+107) 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, -9.5e-203], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 3.4e-231], t$95$0, If[LessEqual[d4, 3.1e-104], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.2e+107], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -d1 \cdot d1\\
\mathbf{if}\;d4 \leq -9.5 \cdot 10^{-203}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 3.4 \cdot 10^{-231}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 3.1 \cdot 10^{-104}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.2 \cdot 10^{+107}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -9.50000000000000035e-203 or 3.4e-231 < d4 < 3.09999999999999976e-104Initial program 92.2%
sub-neg92.2%
associate-+l+92.2%
*-commutative92.2%
+-commutative92.2%
*-commutative92.2%
sub-neg92.2%
+-commutative92.2%
associate--l+92.2%
distribute-lft-out--92.2%
distribute-rgt-out--93.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 34.3%
if -9.50000000000000035e-203 < d4 < 3.4e-231 or 3.09999999999999976e-104 < d4 < 1.2e107Initial program 91.6%
sub-neg91.6%
associate-+l+91.6%
*-commutative91.6%
+-commutative91.6%
*-commutative91.6%
sub-neg91.6%
+-commutative91.6%
associate--l+91.6%
distribute-lft-out--91.6%
distribute-rgt-out--94.0%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 76.4%
+-commutative76.4%
associate--r+76.4%
Simplified76.4%
Taylor expanded in d1 around inf 34.0%
neg-mul-134.0%
Simplified34.0%
if 1.2e107 < d4 Initial program 83.6%
sub-neg83.6%
associate-+l+83.6%
*-commutative83.6%
+-commutative83.6%
*-commutative83.6%
sub-neg83.6%
+-commutative83.6%
associate--l+83.6%
distribute-lft-out--88.3%
distribute-rgt-out--90.6%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 81.9%
Final simplification42.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d4 9e-180) (and (not (<= d4 2.5e-145)) (<= d4 1.8e-35))) (* d1 (- d2 d1)) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d4 <= 9e-180) || (!(d4 <= 2.5e-145) && (d4 <= 1.8e-35))) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d4 <= 9d-180) .or. (.not. (d4 <= 2.5d-145)) .and. (d4 <= 1.8d-35)) then
tmp = d1 * (d2 - d1)
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d4 <= 9e-180) || (!(d4 <= 2.5e-145) && (d4 <= 1.8e-35))) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d4 <= 9e-180) or (not (d4 <= 2.5e-145) and (d4 <= 1.8e-35)): tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d4 <= 9e-180) || (!(d4 <= 2.5e-145) && (d4 <= 1.8e-35))) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d4 <= 9e-180) || (~((d4 <= 2.5e-145)) && (d4 <= 1.8e-35))) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d4, 9e-180], And[N[Not[LessEqual[d4, 2.5e-145]], $MachinePrecision], LessEqual[d4, 1.8e-35]]], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 9 \cdot 10^{-180} \lor \neg \left(d4 \leq 2.5 \cdot 10^{-145}\right) \land d4 \leq 1.8 \cdot 10^{-35}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 9.00000000000000019e-180 or 2.4999999999999999e-145 < d4 < 1.80000000000000009e-35Initial program 91.5%
sub-neg91.5%
associate-+l+91.5%
*-commutative91.5%
+-commutative91.5%
*-commutative91.5%
sub-neg91.5%
+-commutative91.5%
associate--l+91.5%
distribute-lft-out--91.5%
distribute-rgt-out--93.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 73.0%
Taylor expanded in d4 around 0 56.6%
if 9.00000000000000019e-180 < d4 < 2.4999999999999999e-145 or 1.80000000000000009e-35 < d4 Initial program 88.6%
sub-neg88.6%
associate-+l+88.6%
*-commutative88.6%
+-commutative88.6%
*-commutative88.6%
sub-neg88.6%
+-commutative88.6%
associate--l+88.6%
distribute-lft-out--91.1%
distribute-rgt-out--92.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 85.4%
+-commutative85.4%
associate--r+85.4%
Simplified85.4%
Taylor expanded in d1 around 0 74.2%
Final simplification62.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))))
(if (<= d3 -5e+132)
t_0
(if (<= d3 3.7e-90)
(* d1 (+ d2 d4))
(if (<= d3 4.2e+165) (* d1 (- d2 d1)) t_0)))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d3 <= -5e+132) {
tmp = t_0;
} else if (d3 <= 3.7e-90) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 4.2e+165) {
tmp = d1 * (d2 - 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 <= (-5d+132)) then
tmp = t_0
else if (d3 <= 3.7d-90) then
tmp = d1 * (d2 + d4)
else if (d3 <= 4.2d+165) then
tmp = d1 * (d2 - 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 <= -5e+132) {
tmp = t_0;
} else if (d3 <= 3.7e-90) {
tmp = d1 * (d2 + d4);
} else if (d3 <= 4.2e+165) {
tmp = d1 * (d2 - d1);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 tmp = 0 if d3 <= -5e+132: tmp = t_0 elif d3 <= 3.7e-90: tmp = d1 * (d2 + d4) elif d3 <= 4.2e+165: tmp = d1 * (d2 - d1) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d3 <= -5e+132) tmp = t_0; elseif (d3 <= 3.7e-90) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d3 <= 4.2e+165) tmp = Float64(d1 * Float64(d2 - 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 <= -5e+132) tmp = t_0; elseif (d3 <= 3.7e-90) tmp = d1 * (d2 + d4); elseif (d3 <= 4.2e+165) tmp = d1 * (d2 - 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, -5e+132], t$95$0, If[LessEqual[d3, 3.7e-90], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 4.2e+165], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d3 \leq -5 \cdot 10^{+132}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq 3.7 \cdot 10^{-90}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d3 \leq 4.2 \cdot 10^{+165}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d3 < -5.0000000000000001e132 or 4.2000000000000001e165 < d3 Initial program 87.1%
sub-neg87.1%
associate-+l+87.1%
*-commutative87.1%
+-commutative87.1%
*-commutative87.1%
sub-neg87.1%
+-commutative87.1%
associate--l+87.1%
distribute-lft-out--88.5%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around inf 79.7%
mul-1-neg79.7%
distribute-rgt-neg-out79.7%
Simplified79.7%
if -5.0000000000000001e132 < d3 < 3.70000000000000018e-90Initial program 93.2%
sub-neg93.2%
associate-+l+93.2%
*-commutative93.2%
+-commutative93.2%
*-commutative93.2%
sub-neg93.2%
+-commutative93.2%
associate--l+93.2%
distribute-lft-out--93.2%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.4%
Taylor expanded in d1 around 0 76.0%
if 3.70000000000000018e-90 < d3 < 4.2000000000000001e165Initial program 88.8%
sub-neg88.8%
associate-+l+88.8%
*-commutative88.8%
+-commutative88.8%
*-commutative88.8%
sub-neg88.8%
+-commutative88.8%
associate--l+88.8%
distribute-lft-out--90.7%
distribute-rgt-out--92.5%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 86.6%
Taylor expanded in d4 around 0 60.2%
Final simplification73.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -2.25e+132) (* d1 (- (- d1) d3)) (if (<= d3 7e+165) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -2.25e+132) {
tmp = d1 * (-d1 - d3);
} else if (d3 <= 7e+165) {
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.25d+132)) then
tmp = d1 * (-d1 - d3)
else if (d3 <= 7d+165) 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.25e+132) {
tmp = d1 * (-d1 - d3);
} else if (d3 <= 7e+165) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -2.25e+132: tmp = d1 * (-d1 - d3) elif d3 <= 7e+165: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -2.25e+132) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d3 <= 7e+165) 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.25e+132) tmp = d1 * (-d1 - d3); elseif (d3 <= 7e+165) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -2.25e+132], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 7e+165], 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.25 \cdot 10^{+132}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d3 \leq 7 \cdot 10^{+165}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -2.24999999999999986e132Initial program 86.4%
sub-neg86.4%
associate-+l+86.4%
*-commutative86.4%
+-commutative86.4%
*-commutative86.4%
sub-neg86.4%
+-commutative86.4%
associate--l+86.4%
distribute-lft-out--86.4%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 89.4%
+-commutative89.4%
associate--r+89.4%
Simplified89.4%
Taylor expanded in d4 around 0 86.7%
associate-*r*86.7%
neg-mul-186.7%
Simplified86.7%
if -2.24999999999999986e132 < d3 < 6.99999999999999991e165Initial program 91.9%
sub-neg91.9%
associate-+l+91.9%
*-commutative91.9%
+-commutative91.9%
*-commutative91.9%
sub-neg91.9%
+-commutative91.9%
associate--l+91.9%
distribute-lft-out--92.4%
distribute-rgt-out--94.1%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 90.7%
if 6.99999999999999991e165 < d3 Initial program 87.9%
sub-neg87.9%
associate-+l+87.9%
*-commutative87.9%
+-commutative87.9%
*-commutative87.9%
sub-neg87.9%
+-commutative87.9%
associate--l+87.9%
distribute-lft-out--90.9%
distribute-rgt-out--93.9%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 87.3%
+-commutative87.3%
associate--r+87.3%
Simplified87.3%
Taylor expanded in d1 around 0 87.3%
Final simplification89.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.9e+92) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.9e+92) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 1.9d+92) then
tmp = d1 * ((d2 - d3) - d1)
else
tmp = d1 * ((d2 + d4) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.9e+92) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.9e+92: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.9e+92) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.9e+92) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.9e+92], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.9 \cdot 10^{+92}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d4 < 1.9e92Initial program 92.4%
sub-neg92.4%
associate-+l+92.4%
*-commutative92.4%
+-commutative92.4%
*-commutative92.4%
sub-neg92.4%
+-commutative92.4%
associate--l+92.4%
distribute-lft-out--92.4%
distribute-rgt-out--94.3%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.0%
+-commutative84.0%
associate--r+84.0%
Simplified84.0%
if 1.9e92 < d4 Initial program 82.5%
sub-neg82.5%
associate-+l+82.5%
*-commutative82.5%
+-commutative82.5%
*-commutative82.5%
sub-neg82.5%
+-commutative82.5%
associate--l+82.5%
distribute-lft-out--86.9%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.8%
Final simplification86.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 5e+94) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5e+94) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 5d+94) then
tmp = d1 * ((d2 - d3) - d1)
else
tmp = d1 * ((d4 - d3) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 5e+94) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 5e+94: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 5e+94) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(d4 - d3) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 5e+94) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 5e+94], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 5 \cdot 10^{+94}:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\end{array}
if d4 < 5.0000000000000001e94Initial program 92.4%
sub-neg92.4%
associate-+l+92.4%
*-commutative92.4%
+-commutative92.4%
*-commutative92.4%
sub-neg92.4%
+-commutative92.4%
associate--l+92.4%
distribute-lft-out--92.4%
distribute-rgt-out--94.3%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.1%
+-commutative84.1%
associate--r+84.1%
Simplified84.1%
if 5.0000000000000001e94 < d4 Initial program 82.2%
sub-neg82.2%
associate-+l+82.2%
*-commutative82.2%
+-commutative82.2%
*-commutative82.2%
sub-neg82.2%
+-commutative82.2%
associate--l+82.2%
distribute-lft-out--86.6%
distribute-rgt-out--88.8%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around 0 93.4%
+-commutative93.4%
associate--r+93.4%
Simplified93.4%
Final simplification85.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.15e+54) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.15e+54) {
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.15d+54) 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.15e+54) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.15e+54: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.15e+54) 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.15e+54) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.15e+54], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.15 \cdot 10^{+54}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.14999999999999997e54Initial program 92.0%
sub-neg92.0%
associate-+l+92.0%
*-commutative92.0%
+-commutative92.0%
*-commutative92.0%
sub-neg92.0%
+-commutative92.0%
associate--l+92.0%
distribute-lft-out--92.0%
distribute-rgt-out--94.0%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.9%
if 1.14999999999999997e54 < d4 Initial program 85.7%
sub-neg85.7%
associate-+l+85.7%
*-commutative85.7%
+-commutative85.7%
*-commutative85.7%
sub-neg85.7%
+-commutative85.7%
associate--l+85.7%
distribute-lft-out--89.2%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d4 around inf 70.6%
Final simplification41.9%
(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 90.6%
sub-neg90.6%
associate-+l+90.6%
*-commutative90.6%
+-commutative90.6%
*-commutative90.6%
sub-neg90.6%
+-commutative90.6%
associate--l+90.6%
distribute-lft-out--91.4%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
+-commutative100.0%
sub-neg100.0%
+-commutative100.0%
remove-double-neg100.0%
sub-neg100.0%
sub-neg100.0%
distribute-neg-in100.0%
sub-neg100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in d2 around inf 31.1%
Final simplification31.1%
(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 2024021
(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)))