
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- d2 d3) (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d2 - d3) + (d4 - d1))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d3) + (d4 - d1))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d3) + Float64(d4 - d1))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d3) + (d4 - d1)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d3), $MachinePrecision] + N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\end{array}
Initial program 86.7%
associate--l+86.7%
distribute-lft-out--87.5%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (+ d2 d4))))
(if (<= d2 -8.8e+197)
t_0
(if (<= d2 -1.02e+105)
(* d1 (- d2 d1))
(if (<= d2 -1100000000.0)
(* d1 (- d2 d3))
(if (<= d2 -0.0037)
t_0
(if (or (<= d2 -3e-168) (not (<= d2 2.2e-270)))
(* d1 (- d4 d1))
(* d1 (- d4 d3)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 + d4);
double tmp;
if (d2 <= -8.8e+197) {
tmp = t_0;
} else if (d2 <= -1.02e+105) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -1100000000.0) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -0.0037) {
tmp = t_0;
} else if ((d2 <= -3e-168) || !(d2 <= 2.2e-270)) {
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) :: tmp
t_0 = d1 * (d2 + d4)
if (d2 <= (-8.8d+197)) then
tmp = t_0
else if (d2 <= (-1.02d+105)) then
tmp = d1 * (d2 - d1)
else if (d2 <= (-1100000000.0d0)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-0.0037d0)) then
tmp = t_0
else if ((d2 <= (-3d-168)) .or. (.not. (d2 <= 2.2d-270))) 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 tmp;
if (d2 <= -8.8e+197) {
tmp = t_0;
} else if (d2 <= -1.02e+105) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -1100000000.0) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -0.0037) {
tmp = t_0;
} else if ((d2 <= -3e-168) || !(d2 <= 2.2e-270)) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 + d4) tmp = 0 if d2 <= -8.8e+197: tmp = t_0 elif d2 <= -1.02e+105: tmp = d1 * (d2 - d1) elif d2 <= -1100000000.0: tmp = d1 * (d2 - d3) elif d2 <= -0.0037: tmp = t_0 elif (d2 <= -3e-168) or not (d2 <= 2.2e-270): tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d2 <= -8.8e+197) tmp = t_0; elseif (d2 <= -1.02e+105) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d2 <= -1100000000.0) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -0.0037) tmp = t_0; elseif ((d2 <= -3e-168) || !(d2 <= 2.2e-270)) 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); tmp = 0.0; if (d2 <= -8.8e+197) tmp = t_0; elseif (d2 <= -1.02e+105) tmp = d1 * (d2 - d1); elseif (d2 <= -1100000000.0) tmp = d1 * (d2 - d3); elseif (d2 <= -0.0037) tmp = t_0; elseif ((d2 <= -3e-168) || ~((d2 <= 2.2e-270))) 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]}, If[LessEqual[d2, -8.8e+197], t$95$0, If[LessEqual[d2, -1.02e+105], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -1100000000.0], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -0.0037], t$95$0, If[Or[LessEqual[d2, -3e-168], N[Not[LessEqual[d2, 2.2e-270]], $MachinePrecision]], 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)\\
\mathbf{if}\;d2 \leq -8.8 \cdot 10^{+197}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -1.02 \cdot 10^{+105}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -1100000000:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -0.0037:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -3 \cdot 10^{-168} \lor \neg \left(d2 \leq 2.2 \cdot 10^{-270}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -8.79999999999999957e197 or -1.1e9 < d2 < -0.0037000000000000002Initial program 78.9%
associate--l+78.9%
distribute-lft-out--84.2%
distribute-rgt-out--84.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.5%
Taylor expanded in d1 around 0 87.1%
if -8.79999999999999957e197 < d2 < -1.02e105Initial program 65.0%
associate--l+65.0%
distribute-lft-out--65.0%
distribute-rgt-out--65.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 90.9%
Taylor expanded in d4 around 0 85.9%
if -1.02e105 < d2 < -1.1e9Initial program 94.7%
associate--l+94.7%
distribute-lft-out--94.7%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in94.7%
Applied egg-rr94.7%
Taylor expanded in d1 around 0 84.3%
Taylor expanded in d4 around 0 58.7%
if -0.0037000000000000002 < d2 < -2.99999999999999991e-168 or 2.1999999999999998e-270 < d2 Initial program 87.2%
associate--l+87.2%
distribute-lft-out--87.8%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 78.0%
Taylor expanded in d2 around 0 59.3%
if -2.99999999999999991e-168 < d2 < 2.1999999999999998e-270Initial program 97.1%
associate--l+97.1%
distribute-lft-out--97.1%
distribute-rgt-out--97.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in d1 around 0 72.6%
Final simplification65.2%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))))
(if (<= d4 -3.2e-240)
(* d1 d2)
(if (<= d4 -1.2e-259)
t_0
(if (<= d4 6.3e-288)
(* d1 d2)
(if (<= d4 1.3e-217)
(* d1 (- d3))
(if (<= d4 4.7e+41)
t_0
(if (<= d4 2.8e+54) (* d1 d2) (* d1 d4)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double tmp;
if (d4 <= -3.2e-240) {
tmp = d1 * d2;
} else if (d4 <= -1.2e-259) {
tmp = t_0;
} else if (d4 <= 6.3e-288) {
tmp = d1 * d2;
} else if (d4 <= 1.3e-217) {
tmp = d1 * -d3;
} else if (d4 <= 4.7e+41) {
tmp = t_0;
} else if (d4 <= 2.8e+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) :: t_0
real(8) :: tmp
t_0 = d1 * -d1
if (d4 <= (-3.2d-240)) then
tmp = d1 * d2
else if (d4 <= (-1.2d-259)) then
tmp = t_0
else if (d4 <= 6.3d-288) then
tmp = d1 * d2
else if (d4 <= 1.3d-217) then
tmp = d1 * -d3
else if (d4 <= 4.7d+41) then
tmp = t_0
else if (d4 <= 2.8d+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 t_0 = d1 * -d1;
double tmp;
if (d4 <= -3.2e-240) {
tmp = d1 * d2;
} else if (d4 <= -1.2e-259) {
tmp = t_0;
} else if (d4 <= 6.3e-288) {
tmp = d1 * d2;
} else if (d4 <= 1.3e-217) {
tmp = d1 * -d3;
} else if (d4 <= 4.7e+41) {
tmp = t_0;
} else if (d4 <= 2.8e+54) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 tmp = 0 if d4 <= -3.2e-240: tmp = d1 * d2 elif d4 <= -1.2e-259: tmp = t_0 elif d4 <= 6.3e-288: tmp = d1 * d2 elif d4 <= 1.3e-217: tmp = d1 * -d3 elif d4 <= 4.7e+41: tmp = t_0 elif d4 <= 2.8e+54: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) tmp = 0.0 if (d4 <= -3.2e-240) tmp = Float64(d1 * d2); elseif (d4 <= -1.2e-259) tmp = t_0; elseif (d4 <= 6.3e-288) tmp = Float64(d1 * d2); elseif (d4 <= 1.3e-217) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 4.7e+41) tmp = t_0; elseif (d4 <= 2.8e+54) tmp = Float64(d1 * d2); 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 <= -3.2e-240) tmp = d1 * d2; elseif (d4 <= -1.2e-259) tmp = t_0; elseif (d4 <= 6.3e-288) tmp = d1 * d2; elseif (d4 <= 1.3e-217) tmp = d1 * -d3; elseif (d4 <= 4.7e+41) tmp = t_0; elseif (d4 <= 2.8e+54) tmp = d1 * d2; 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, -3.2e-240], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, -1.2e-259], t$95$0, If[LessEqual[d4, 6.3e-288], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.3e-217], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 4.7e+41], t$95$0, If[LessEqual[d4, 2.8e+54], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
\mathbf{if}\;d4 \leq -3.2 \cdot 10^{-240}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq -1.2 \cdot 10^{-259}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 6.3 \cdot 10^{-288}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.3 \cdot 10^{-217}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 4.7 \cdot 10^{+41}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.8 \cdot 10^{+54}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -3.1999999999999999e-240 or -1.2e-259 < d4 < 6.3000000000000002e-288 or 4.70000000000000001e41 < d4 < 2.80000000000000015e54Initial program 84.4%
associate--l+84.4%
distribute-lft-out--84.4%
distribute-rgt-out--89.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 35.5%
if -3.1999999999999999e-240 < d4 < -1.2e-259 or 1.29999999999999997e-217 < d4 < 4.70000000000000001e41Initial program 92.3%
associate--l+92.3%
distribute-lft-out--93.8%
distribute-rgt-out--93.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 83.5%
Taylor expanded in d1 around inf 56.6%
neg-mul-156.6%
Simplified56.6%
if 6.3000000000000002e-288 < d4 < 1.29999999999999997e-217Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 72.8%
mul-1-neg72.8%
distribute-rgt-neg-out72.8%
Simplified72.8%
if 2.80000000000000015e54 < d4 Initial program 80.0%
associate--l+80.0%
distribute-lft-out--82.2%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 67.3%
(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 -2.7e+91)
t_1
(if (<= d3 -2.15e-300)
t_2
(if (<= d3 9.8e-138)
t_0
(if (<= d3 4.5e-99) t_2 (if (<= d3 5.5e+18) t_0 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 <= -2.7e+91) {
tmp = t_1;
} else if (d3 <= -2.15e-300) {
tmp = t_2;
} else if (d3 <= 9.8e-138) {
tmp = t_0;
} else if (d3 <= 4.5e-99) {
tmp = t_2;
} else if (d3 <= 5.5e+18) {
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 + d4)
t_1 = d1 * (d2 - d3)
t_2 = d1 * (d2 - d1)
if (d3 <= (-2.7d+91)) then
tmp = t_1
else if (d3 <= (-2.15d-300)) then
tmp = t_2
else if (d3 <= 9.8d-138) then
tmp = t_0
else if (d3 <= 4.5d-99) then
tmp = t_2
else if (d3 <= 5.5d+18) 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 + d4);
double t_1 = d1 * (d2 - d3);
double t_2 = d1 * (d2 - d1);
double tmp;
if (d3 <= -2.7e+91) {
tmp = t_1;
} else if (d3 <= -2.15e-300) {
tmp = t_2;
} else if (d3 <= 9.8e-138) {
tmp = t_0;
} else if (d3 <= 4.5e-99) {
tmp = t_2;
} else if (d3 <= 5.5e+18) {
tmp = t_0;
} 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 <= -2.7e+91: tmp = t_1 elif d3 <= -2.15e-300: tmp = t_2 elif d3 <= 9.8e-138: tmp = t_0 elif d3 <= 4.5e-99: tmp = t_2 elif d3 <= 5.5e+18: tmp = t_0 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 <= -2.7e+91) tmp = t_1; elseif (d3 <= -2.15e-300) tmp = t_2; elseif (d3 <= 9.8e-138) tmp = t_0; elseif (d3 <= 4.5e-99) tmp = t_2; elseif (d3 <= 5.5e+18) tmp = t_0; 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 <= -2.7e+91) tmp = t_1; elseif (d3 <= -2.15e-300) tmp = t_2; elseif (d3 <= 9.8e-138) tmp = t_0; elseif (d3 <= 4.5e-99) tmp = t_2; elseif (d3 <= 5.5e+18) 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 + 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, -2.7e+91], t$95$1, If[LessEqual[d3, -2.15e-300], t$95$2, If[LessEqual[d3, 9.8e-138], t$95$0, If[LessEqual[d3, 4.5e-99], t$95$2, If[LessEqual[d3, 5.5e+18], t$95$0, 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 -2.7 \cdot 10^{+91}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq -2.15 \cdot 10^{-300}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 9.8 \cdot 10^{-138}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 4.5 \cdot 10^{-99}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 5.5 \cdot 10^{+18}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d3 < -2.7e91 or 5.5e18 < d3 Initial program 83.5%
associate--l+83.5%
distribute-lft-out--85.6%
distribute-rgt-out--88.6%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in88.6%
Applied egg-rr88.6%
Taylor expanded in d1 around 0 92.6%
Taylor expanded in d4 around 0 76.5%
if -2.7e91 < d3 < -2.15e-300 or 9.80000000000000033e-138 < d3 < 4.5000000000000003e-99Initial program 84.2%
associate--l+84.2%
distribute-lft-out--84.2%
distribute-rgt-out--89.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.0%
Taylor expanded in d4 around 0 76.1%
if -2.15e-300 < d3 < 9.80000000000000033e-138 or 4.5000000000000003e-99 < d3 < 5.5e18Initial program 95.3%
associate--l+95.3%
distribute-lft-out--95.3%
distribute-rgt-out--96.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.1%
Taylor expanded in d1 around 0 81.1%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (+ d2 d4))))
(if (<= d2 -5e+199)
t_0
(if (<= d2 -3e+106)
(* d1 (- d2 d1))
(if (<= d2 -5500000000000.0)
(* d1 (- d2 d3))
(if (<= d2 -0.0045) t_0 (* d1 (- d4 d1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 + d4);
double tmp;
if (d2 <= -5e+199) {
tmp = t_0;
} else if (d2 <= -3e+106) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -5500000000000.0) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -0.0045) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 + d4)
if (d2 <= (-5d+199)) then
tmp = t_0
else if (d2 <= (-3d+106)) then
tmp = d1 * (d2 - d1)
else if (d2 <= (-5500000000000.0d0)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-0.0045d0)) then
tmp = t_0
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 + d4);
double tmp;
if (d2 <= -5e+199) {
tmp = t_0;
} else if (d2 <= -3e+106) {
tmp = d1 * (d2 - d1);
} else if (d2 <= -5500000000000.0) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -0.0045) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 + d4) tmp = 0 if d2 <= -5e+199: tmp = t_0 elif d2 <= -3e+106: tmp = d1 * (d2 - d1) elif d2 <= -5500000000000.0: tmp = d1 * (d2 - d3) elif d2 <= -0.0045: tmp = t_0 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d2 <= -5e+199) tmp = t_0; elseif (d2 <= -3e+106) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d2 <= -5500000000000.0) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -0.0045) tmp = t_0; else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 + d4); tmp = 0.0; if (d2 <= -5e+199) tmp = t_0; elseif (d2 <= -3e+106) tmp = d1 * (d2 - d1); elseif (d2 <= -5500000000000.0) tmp = d1 * (d2 - d3); elseif (d2 <= -0.0045) tmp = t_0; else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -5e+199], t$95$0, If[LessEqual[d2, -3e+106], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -5500000000000.0], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -0.0045], t$95$0, N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d2 \leq -5 \cdot 10^{+199}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d2 \leq -3 \cdot 10^{+106}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -5500000000000:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -0.0045:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -4.9999999999999998e199 or -5.5e12 < d2 < -0.00449999999999999966Initial program 78.9%
associate--l+78.9%
distribute-lft-out--84.2%
distribute-rgt-out--84.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 89.5%
Taylor expanded in d1 around 0 87.1%
if -4.9999999999999998e199 < d2 < -3.0000000000000001e106Initial program 65.0%
associate--l+65.0%
distribute-lft-out--65.0%
distribute-rgt-out--65.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 90.9%
Taylor expanded in d4 around 0 85.9%
if -3.0000000000000001e106 < d2 < -5.5e12Initial program 94.7%
associate--l+94.7%
distribute-lft-out--94.7%
distribute-rgt-out--94.7%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in94.7%
Applied egg-rr94.7%
Taylor expanded in d1 around 0 84.3%
Taylor expanded in d4 around 0 58.7%
if -0.00449999999999999966 < d2 Initial program 88.9%
associate--l+88.9%
distribute-lft-out--89.4%
distribute-rgt-out--93.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 76.9%
Taylor expanded in d2 around 0 61.4%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d1))) (t_1 (* d1 (+ d2 d4))))
(if (<= d1 -6.5e+158)
t_0
(if (<= d1 -3.4e-244)
t_1
(if (<= d1 -5.2e-265) (* d1 (- d3)) (if (<= d1 1.3e-12) t_1 t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d1;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d1 <= -6.5e+158) {
tmp = t_0;
} else if (d1 <= -3.4e-244) {
tmp = t_1;
} else if (d1 <= -5.2e-265) {
tmp = d1 * -d3;
} else if (d1 <= 1.3e-12) {
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 * -d1
t_1 = d1 * (d2 + d4)
if (d1 <= (-6.5d+158)) then
tmp = t_0
else if (d1 <= (-3.4d-244)) then
tmp = t_1
else if (d1 <= (-5.2d-265)) then
tmp = d1 * -d3
else if (d1 <= 1.3d-12) 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 * -d1;
double t_1 = d1 * (d2 + d4);
double tmp;
if (d1 <= -6.5e+158) {
tmp = t_0;
} else if (d1 <= -3.4e-244) {
tmp = t_1;
} else if (d1 <= -5.2e-265) {
tmp = d1 * -d3;
} else if (d1 <= 1.3e-12) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d1 t_1 = d1 * (d2 + d4) tmp = 0 if d1 <= -6.5e+158: tmp = t_0 elif d1 <= -3.4e-244: tmp = t_1 elif d1 <= -5.2e-265: tmp = d1 * -d3 elif d1 <= 1.3e-12: tmp = t_1 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d1)) t_1 = Float64(d1 * Float64(d2 + d4)) tmp = 0.0 if (d1 <= -6.5e+158) tmp = t_0; elseif (d1 <= -3.4e-244) tmp = t_1; elseif (d1 <= -5.2e-265) tmp = Float64(d1 * Float64(-d3)); elseif (d1 <= 1.3e-12) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d1; t_1 = d1 * (d2 + d4); tmp = 0.0; if (d1 <= -6.5e+158) tmp = t_0; elseif (d1 <= -3.4e-244) tmp = t_1; elseif (d1 <= -5.2e-265) tmp = d1 * -d3; elseif (d1 <= 1.3e-12) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d1)), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -6.5e+158], t$95$0, If[LessEqual[d1, -3.4e-244], t$95$1, If[LessEqual[d1, -5.2e-265], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d1, 1.3e-12], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d1\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d1 \leq -6.5 \cdot 10^{+158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d1 \leq -3.4 \cdot 10^{-244}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d1 \leq -5.2 \cdot 10^{-265}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d1 \leq 1.3 \cdot 10^{-12}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d1 < -6.5000000000000001e158 or 1.29999999999999991e-12 < d1 Initial program 66.3%
associate--l+66.3%
distribute-lft-out--68.4%
distribute-rgt-out--76.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 90.6%
Taylor expanded in d1 around inf 74.6%
neg-mul-174.6%
Simplified74.6%
if -6.5000000000000001e158 < d1 < -3.40000000000000009e-244 or -5.2000000000000002e-265 < d1 < 1.29999999999999991e-12Initial program 98.7%
associate--l+98.7%
distribute-lft-out--98.7%
distribute-rgt-out--99.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 75.2%
Taylor expanded in d1 around 0 68.7%
if -3.40000000000000009e-244 < d1 < -5.2000000000000002e-265Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 2.2e-285)
(* d1 (- d2 d1))
(if (<= d4 7.9e+40)
(* d1 (- (- d1) d3))
(if (<= d4 1.14e+55) (* d1 (- d2 d3)) (* d1 (- d4 d1))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.2e-285) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 7.9e+40) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 1.14e+55) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 2.2d-285) then
tmp = d1 * (d2 - d1)
else if (d4 <= 7.9d+40) then
tmp = d1 * (-d1 - d3)
else if (d4 <= 1.14d+55) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.2e-285) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 7.9e+40) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 1.14e+55) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.2e-285: tmp = d1 * (d2 - d1) elif d4 <= 7.9e+40: tmp = d1 * (-d1 - d3) elif d4 <= 1.14e+55: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.2e-285) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 7.9e+40) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d4 <= 1.14e+55) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.2e-285) tmp = d1 * (d2 - d1); elseif (d4 <= 7.9e+40) tmp = d1 * (-d1 - d3); elseif (d4 <= 1.14e+55) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.2e-285], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 7.9e+40], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.14e+55], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.2 \cdot 10^{-285}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 7.9 \cdot 10^{+40}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d4 \leq 1.14 \cdot 10^{+55}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d4 < 2.1999999999999999e-285Initial program 85.5%
associate--l+85.5%
distribute-lft-out--85.5%
distribute-rgt-out--90.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 77.2%
Taylor expanded in d4 around 0 57.1%
if 2.1999999999999999e-285 < d4 < 7.8999999999999997e40Initial program 93.3%
associate--l+93.3%
distribute-lft-out--94.6%
distribute-rgt-out--94.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 78.6%
+-commutative78.6%
associate--r+78.6%
Simplified78.6%
Taylor expanded in d4 around 0 74.9%
associate-*r*74.9%
neg-mul-174.9%
Simplified74.9%
if 7.8999999999999997e40 < d4 < 1.1399999999999999e55Initial program 80.0%
associate--l+80.0%
distribute-lft-out--80.0%
distribute-rgt-out--80.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in80.0%
Applied egg-rr80.0%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d4 around 0 100.0%
if 1.1399999999999999e55 < d4 Initial program 80.0%
associate--l+80.0%
distribute-lft-out--82.2%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.0%
Taylor expanded in d2 around 0 80.3%
Final simplification67.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))))
(if (<= d4 9.2e-253)
t_0
(if (<= d4 2.65e-223)
(* d1 (- d3))
(if (<= d4 2.7e+107) t_0 (* d1 (+ d2 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 9.2e-253) {
tmp = t_0;
} else if (d4 <= 2.65e-223) {
tmp = d1 * -d3;
} else if (d4 <= 2.7e+107) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d2 - d1)
if (d4 <= 9.2d-253) then
tmp = t_0
else if (d4 <= 2.65d-223) then
tmp = d1 * -d3
else if (d4 <= 2.7d+107) then
tmp = t_0
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double tmp;
if (d4 <= 9.2e-253) {
tmp = t_0;
} else if (d4 <= 2.65e-223) {
tmp = d1 * -d3;
} else if (d4 <= 2.7e+107) {
tmp = t_0;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) tmp = 0 if d4 <= 9.2e-253: tmp = t_0 elif d4 <= 2.65e-223: tmp = d1 * -d3 elif d4 <= 2.7e+107: tmp = t_0 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d4 <= 9.2e-253) tmp = t_0; elseif (d4 <= 2.65e-223) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 2.7e+107) tmp = t_0; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); tmp = 0.0; if (d4 <= 9.2e-253) tmp = t_0; elseif (d4 <= 2.65e-223) tmp = d1 * -d3; elseif (d4 <= 2.7e+107) tmp = t_0; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, 9.2e-253], t$95$0, If[LessEqual[d4, 2.65e-223], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 2.7e+107], t$95$0, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d4 \leq 9.2 \cdot 10^{-253}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.65 \cdot 10^{-223}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 2.7 \cdot 10^{+107}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 9.2000000000000001e-253 or 2.65000000000000013e-223 < d4 < 2.7000000000000001e107Initial program 87.4%
associate--l+87.4%
distribute-lft-out--87.8%
distribute-rgt-out--90.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 79.2%
Taylor expanded in d4 around 0 63.9%
if 9.2000000000000001e-253 < d4 < 2.65000000000000013e-223Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 88.0%
mul-1-neg88.0%
distribute-rgt-neg-out88.0%
Simplified88.0%
if 2.7000000000000001e107 < d4 Initial program 79.4%
associate--l+79.4%
distribute-lft-out--82.4%
distribute-rgt-out--91.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 91.0%
Taylor expanded in d1 around 0 76.5%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -4.6e-242)
(* d1 d2)
(if (<= d4 4.7e+41)
(* d1 (- d1))
(if (<= d4 7.6e+54) (* d1 d2) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -4.6e-242) {
tmp = d1 * d2;
} else if (d4 <= 4.7e+41) {
tmp = d1 * -d1;
} else if (d4 <= 7.6e+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 <= (-4.6d-242)) then
tmp = d1 * d2
else if (d4 <= 4.7d+41) then
tmp = d1 * -d1
else if (d4 <= 7.6d+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 <= -4.6e-242) {
tmp = d1 * d2;
} else if (d4 <= 4.7e+41) {
tmp = d1 * -d1;
} else if (d4 <= 7.6e+54) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -4.6e-242: tmp = d1 * d2 elif d4 <= 4.7e+41: tmp = d1 * -d1 elif d4 <= 7.6e+54: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -4.6e-242) tmp = Float64(d1 * d2); elseif (d4 <= 4.7e+41) tmp = Float64(d1 * Float64(-d1)); elseif (d4 <= 7.6e+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 <= -4.6e-242) tmp = d1 * d2; elseif (d4 <= 4.7e+41) tmp = d1 * -d1; elseif (d4 <= 7.6e+54) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -4.6e-242], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 4.7e+41], N[(d1 * (-d1)), $MachinePrecision], If[LessEqual[d4, 7.6e+54], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -4.6 \cdot 10^{-242}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 4.7 \cdot 10^{+41}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{elif}\;d4 \leq 7.6 \cdot 10^{+54}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < -4.59999999999999969e-242 or 4.70000000000000001e41 < d4 < 7.6000000000000005e54Initial program 83.5%
associate--l+83.5%
distribute-lft-out--83.5%
distribute-rgt-out--88.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.7%
if -4.59999999999999969e-242 < d4 < 4.70000000000000001e41Initial program 93.7%
associate--l+93.7%
distribute-lft-out--94.8%
distribute-rgt-out--94.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 78.3%
Taylor expanded in d1 around inf 51.5%
neg-mul-151.5%
Simplified51.5%
if 7.6000000000000005e54 < d4 Initial program 80.0%
associate--l+80.0%
distribute-lft-out--82.2%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 67.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -2.2e+91) (not (<= d3 480000000.0))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.2e+91) || !(d3 <= 480000000.0)) {
tmp = d1 * ((d2 + d4) - d3);
} 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 ((d3 <= (-2.2d+91)) .or. (.not. (d3 <= 480000000.0d0))) then
tmp = d1 * ((d2 + d4) - d3)
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 ((d3 <= -2.2e+91) || !(d3 <= 480000000.0)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -2.2e+91) or not (d3 <= 480000000.0): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -2.2e+91) || !(d3 <= 480000000.0)) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); 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 ((d3 <= -2.2e+91) || ~((d3 <= 480000000.0))) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -2.2e+91], N[Not[LessEqual[d3, 480000000.0]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -2.2 \cdot 10^{+91} \lor \neg \left(d3 \leq 480000000\right):\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -2.19999999999999999e91 or 4.8e8 < d3 Initial program 83.6%
associate--l+83.6%
distribute-lft-out--85.7%
distribute-rgt-out--88.8%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in88.8%
Applied egg-rr88.8%
Taylor expanded in d1 around 0 92.6%
if -2.19999999999999999e91 < d3 < 4.8e8Initial program 88.6%
associate--l+88.6%
distribute-lft-out--88.6%
distribute-rgt-out--92.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.1%
Final simplification96.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -2.65e+128) (not (<= d3 2.5e+113))) (* d1 (- d4 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.65e+128) || !(d3 <= 2.5e+113)) {
tmp = d1 * (d4 - d3);
} 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 ((d3 <= (-2.65d+128)) .or. (.not. (d3 <= 2.5d+113))) then
tmp = d1 * (d4 - d3)
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 ((d3 <= -2.65e+128) || !(d3 <= 2.5e+113)) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -2.65e+128) or not (d3 <= 2.5e+113): tmp = d1 * (d4 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -2.65e+128) || !(d3 <= 2.5e+113)) tmp = Float64(d1 * Float64(d4 - d3)); 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 ((d3 <= -2.65e+128) || ~((d3 <= 2.5e+113))) tmp = d1 * (d4 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -2.65e+128], N[Not[LessEqual[d3, 2.5e+113]], $MachinePrecision]], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -2.65 \cdot 10^{+128} \lor \neg \left(d3 \leq 2.5 \cdot 10^{+113}\right):\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -2.6500000000000001e128 or 2.5e113 < d3 Initial program 80.0%
associate--l+80.0%
distribute-lft-out--82.9%
distribute-rgt-out--87.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 88.1%
+-commutative88.1%
associate--r+88.1%
Simplified88.1%
Taylor expanded in d1 around 0 83.9%
if -2.6500000000000001e128 < d3 < 2.5e113Initial program 89.2%
associate--l+89.2%
distribute-lft-out--89.2%
distribute-rgt-out--92.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.9%
Final simplification91.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -8.8e+197) (* d1 (- (+ d2 d4) d3)) (if (<= d2 -0.000175) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d3) d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -8.8e+197) {
tmp = d1 * ((d2 + d4) - d3);
} else if (d2 <= -0.000175) {
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 (d2 <= (-8.8d+197)) then
tmp = d1 * ((d2 + d4) - d3)
else if (d2 <= (-0.000175d0)) 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 (d2 <= -8.8e+197) {
tmp = d1 * ((d2 + d4) - d3);
} else if (d2 <= -0.000175) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -8.8e+197: tmp = d1 * ((d2 + d4) - d3) elif d2 <= -0.000175: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -8.8e+197) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); elseif (d2 <= -0.000175) 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 (d2 <= -8.8e+197) tmp = d1 * ((d2 + d4) - d3); elseif (d2 <= -0.000175) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -8.8e+197], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -0.000175], 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}\;d2 \leq -8.8 \cdot 10^{+197}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{elif}\;d2 \leq -0.000175:\\
\;\;\;\;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 d2 < -8.79999999999999957e197Initial program 75.0%
associate--l+75.0%
distribute-lft-out--81.3%
distribute-rgt-out--81.3%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in81.3%
Applied egg-rr81.3%
Taylor expanded in d1 around 0 100.0%
if -8.79999999999999957e197 < d2 < -1.74999999999999998e-4Initial program 80.9%
associate--l+80.9%
distribute-lft-out--80.9%
distribute-rgt-out--80.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.0%
+-commutative84.0%
associate--r+84.0%
Simplified84.0%
if -1.74999999999999998e-4 < d2 Initial program 88.9%
associate--l+88.9%
distribute-lft-out--89.4%
distribute-rgt-out--93.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 83.9%
+-commutative83.9%
associate--r+83.9%
Simplified83.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 4.6e+55) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.6e+55) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 4.6d+55) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.6e+55) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 4.6e+55: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 4.6e+55) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 4.6e+55) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 4.6e+55], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 4.6 \cdot 10^{+55}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 4.59999999999999975e55Initial program 88.1%
associate--l+88.1%
distribute-lft-out--88.6%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 34.9%
if 4.59999999999999975e55 < d4 Initial program 80.0%
associate--l+80.0%
distribute-lft-out--82.2%
distribute-rgt-out--88.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 67.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d2))
double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * d2
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d2;
}
def code(d1, d2, d3, d4): return d1 * d2
function code(d1, d2, d3, d4) return Float64(d1 * d2) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d2; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d2), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d2
\end{array}
Initial program 86.7%
associate--l+86.7%
distribute-lft-out--87.5%
distribute-rgt-out--91.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 32.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ (- d2 d3) d4) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (((d2 - d3) + d4) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
def code(d1, d2, d3, d4): return d1 * (((d2 - d3) + d4) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(Float64(d2 - d3) + d4) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (((d2 - d3) + d4) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(N[(d2 - d3), $MachinePrecision] + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)
\end{array}
herbie shell --seed 2024089
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))