
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (d1 d2 d3 d4) :precision binary64 (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
def code(d1, d2, d3, d4): return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
function code(d1, d2, d3, d4) return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) end
function tmp = code(d1, d2, d3, d4) tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1); end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\end{array}
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ (- d2 d3) (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * ((d2 - d3) + (d4 - d1))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d3) + (d4 - d1));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d3) + (d4 - d1))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d3) + Float64(d4 - d1))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d3) + (d4 - d1)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d3), $MachinePrecision] + N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\end{array}
Initial program 89.4%
associate--l+89.4%
distribute-lft-out--89.4%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (+ d2 d4))) (t_1 (* d1 (- d3))) (t_2 (* d1 (- d2 d1))))
(if (<= d3 -3.4e+151)
t_1
(if (<= d3 -5.5e-166)
t_2
(if (<= d3 9.8e-300)
t_0
(if (<= d3 3.4e-284)
t_2
(if (<= d3 6.8e-171)
t_0
(if (<= d3 8.2e+52) t_2 (if (<= d3 3.2e+153) t_0 t_1)))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 + d4);
double t_1 = d1 * -d3;
double t_2 = d1 * (d2 - d1);
double tmp;
if (d3 <= -3.4e+151) {
tmp = t_1;
} else if (d3 <= -5.5e-166) {
tmp = t_2;
} else if (d3 <= 9.8e-300) {
tmp = t_0;
} else if (d3 <= 3.4e-284) {
tmp = t_2;
} else if (d3 <= 6.8e-171) {
tmp = t_0;
} else if (d3 <= 8.2e+52) {
tmp = t_2;
} else if (d3 <= 3.2e+153) {
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 * -d3
t_2 = d1 * (d2 - d1)
if (d3 <= (-3.4d+151)) then
tmp = t_1
else if (d3 <= (-5.5d-166)) then
tmp = t_2
else if (d3 <= 9.8d-300) then
tmp = t_0
else if (d3 <= 3.4d-284) then
tmp = t_2
else if (d3 <= 6.8d-171) then
tmp = t_0
else if (d3 <= 8.2d+52) then
tmp = t_2
else if (d3 <= 3.2d+153) 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 * -d3;
double t_2 = d1 * (d2 - d1);
double tmp;
if (d3 <= -3.4e+151) {
tmp = t_1;
} else if (d3 <= -5.5e-166) {
tmp = t_2;
} else if (d3 <= 9.8e-300) {
tmp = t_0;
} else if (d3 <= 3.4e-284) {
tmp = t_2;
} else if (d3 <= 6.8e-171) {
tmp = t_0;
} else if (d3 <= 8.2e+52) {
tmp = t_2;
} else if (d3 <= 3.2e+153) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 + d4) t_1 = d1 * -d3 t_2 = d1 * (d2 - d1) tmp = 0 if d3 <= -3.4e+151: tmp = t_1 elif d3 <= -5.5e-166: tmp = t_2 elif d3 <= 9.8e-300: tmp = t_0 elif d3 <= 3.4e-284: tmp = t_2 elif d3 <= 6.8e-171: tmp = t_0 elif d3 <= 8.2e+52: tmp = t_2 elif d3 <= 3.2e+153: 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(-d3)) t_2 = Float64(d1 * Float64(d2 - d1)) tmp = 0.0 if (d3 <= -3.4e+151) tmp = t_1; elseif (d3 <= -5.5e-166) tmp = t_2; elseif (d3 <= 9.8e-300) tmp = t_0; elseif (d3 <= 3.4e-284) tmp = t_2; elseif (d3 <= 6.8e-171) tmp = t_0; elseif (d3 <= 8.2e+52) tmp = t_2; elseif (d3 <= 3.2e+153) 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 * -d3; t_2 = d1 * (d2 - d1); tmp = 0.0; if (d3 <= -3.4e+151) tmp = t_1; elseif (d3 <= -5.5e-166) tmp = t_2; elseif (d3 <= 9.8e-300) tmp = t_0; elseif (d3 <= 3.4e-284) tmp = t_2; elseif (d3 <= 6.8e-171) tmp = t_0; elseif (d3 <= 8.2e+52) tmp = t_2; elseif (d3 <= 3.2e+153) 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 * (-d3)), $MachinePrecision]}, Block[{t$95$2 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -3.4e+151], t$95$1, If[LessEqual[d3, -5.5e-166], t$95$2, If[LessEqual[d3, 9.8e-300], t$95$0, If[LessEqual[d3, 3.4e-284], t$95$2, If[LessEqual[d3, 6.8e-171], t$95$0, If[LessEqual[d3, 8.2e+52], t$95$2, If[LessEqual[d3, 3.2e+153], 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(-d3\right)\\
t_2 := d1 \cdot \left(d2 - d1\right)\\
\mathbf{if}\;d3 \leq -3.4 \cdot 10^{+151}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d3 \leq -5.5 \cdot 10^{-166}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 9.8 \cdot 10^{-300}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 3.4 \cdot 10^{-284}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 6.8 \cdot 10^{-171}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 8.2 \cdot 10^{+52}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;d3 \leq 3.2 \cdot 10^{+153}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if d3 < -3.4e151 or 3.2000000000000001e153 < d3 Initial program 91.3%
associate--l+91.3%
distribute-lft-out--91.3%
distribute-rgt-out--91.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 82.1%
mul-1-neg82.1%
distribute-rgt-neg-out82.1%
Simplified82.1%
if -3.4e151 < d3 < -5.4999999999999997e-166 or 9.8e-300 < d3 < 3.39999999999999991e-284 or 6.7999999999999997e-171 < d3 < 8.1999999999999999e52Initial program 85.9%
associate--l+85.9%
distribute-lft-out--85.9%
distribute-rgt-out--90.0%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 74.0%
+-commutative74.0%
associate--r+74.0%
Simplified74.0%
Taylor expanded in d3 around 0 64.7%
if -5.4999999999999997e-166 < d3 < 9.8e-300 or 3.39999999999999991e-284 < d3 < 6.7999999999999997e-171 or 8.1999999999999999e52 < d3 < 3.2000000000000001e153Initial program 93.9%
associate--l+93.9%
distribute-lft-out--93.9%
distribute-rgt-out--98.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 95.3%
Taylor expanded in d1 around 0 86.5%
+-commutative86.5%
Simplified86.5%
Final simplification75.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -2.75e-235)
t_0
(if (<= d4 4.5e-246)
t_1
(if (<= d4 3.4e-196) t_0 (if (<= d4 1.5e+110) t_1 (* d1 (+ d2 d4))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -2.75e-235) {
tmp = t_0;
} else if (d4 <= 4.5e-246) {
tmp = t_1;
} else if (d4 <= 3.4e-196) {
tmp = t_0;
} else if (d4 <= 1.5e+110) {
tmp = t_1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= (-2.75d-235)) then
tmp = t_0
else if (d4 <= 4.5d-246) then
tmp = t_1
else if (d4 <= 3.4d-196) then
tmp = t_0
else if (d4 <= 1.5d+110) then
tmp = t_1
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -2.75e-235) {
tmp = t_0;
} else if (d4 <= 4.5e-246) {
tmp = t_1;
} else if (d4 <= 3.4e-196) {
tmp = t_0;
} else if (d4 <= 1.5e+110) {
tmp = t_1;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -2.75e-235: tmp = t_0 elif d4 <= 4.5e-246: tmp = t_1 elif d4 <= 3.4e-196: tmp = t_0 elif d4 <= 1.5e+110: tmp = t_1 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= -2.75e-235) tmp = t_0; elseif (d4 <= 4.5e-246) tmp = t_1; elseif (d4 <= 3.4e-196) tmp = t_0; elseif (d4 <= 1.5e+110) tmp = t_1; else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= -2.75e-235) tmp = t_0; elseif (d4 <= 4.5e-246) tmp = t_1; elseif (d4 <= 3.4e-196) tmp = t_0; elseif (d4 <= 1.5e+110) tmp = t_1; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, -2.75e-235], t$95$0, If[LessEqual[d4, 4.5e-246], t$95$1, If[LessEqual[d4, 3.4e-196], t$95$0, If[LessEqual[d4, 1.5e+110], t$95$1, N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq -2.75 \cdot 10^{-235}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 4.5 \cdot 10^{-246}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 3.4 \cdot 10^{-196}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 1.5 \cdot 10^{+110}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -2.7499999999999999e-235 or 4.49999999999999999e-246 < d4 < 3.4e-196Initial program 86.9%
associate--l+86.9%
distribute-lft-out--86.9%
distribute-rgt-out--92.3%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 74.3%
+-commutative74.3%
associate--r+74.3%
Simplified74.3%
Taylor expanded in d3 around 0 55.7%
if -2.7499999999999999e-235 < d4 < 4.49999999999999999e-246 or 3.4e-196 < d4 < 1.50000000000000004e110Initial program 93.5%
associate--l+93.5%
distribute-lft-out--93.5%
distribute-rgt-out--93.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 93.4%
+-commutative93.4%
associate--r+93.4%
Simplified93.4%
Taylor expanded in d1 around 0 79.7%
if 1.50000000000000004e110 < d4 Initial program 87.9%
associate--l+87.9%
distribute-lft-out--87.9%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.2%
Taylor expanded in d1 around 0 85.5%
+-commutative85.5%
Simplified85.5%
Final simplification68.3%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d4 -4.8e-236)
t_0
(if (<= d4 2.3e-245)
t_1
(if (<= d4 5e-197) t_0 (if (<= d4 4.5e+68) t_1 (* d1 (- d4 d3))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -4.8e-236) {
tmp = t_0;
} else if (d4 <= 2.3e-245) {
tmp = t_1;
} else if (d4 <= 5e-197) {
tmp = t_0;
} else if (d4 <= 4.5e+68) {
tmp = t_1;
} 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 - d1)
t_1 = d1 * (d2 - d3)
if (d4 <= (-4.8d-236)) then
tmp = t_0
else if (d4 <= 2.3d-245) then
tmp = t_1
else if (d4 <= 5d-197) then
tmp = t_0
else if (d4 <= 4.5d+68) then
tmp = t_1
else
tmp = d1 * (d4 - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d4 <= -4.8e-236) {
tmp = t_0;
} else if (d4 <= 2.3e-245) {
tmp = t_1;
} else if (d4 <= 5e-197) {
tmp = t_0;
} else if (d4 <= 4.5e+68) {
tmp = t_1;
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d4 <= -4.8e-236: tmp = t_0 elif d4 <= 2.3e-245: tmp = t_1 elif d4 <= 5e-197: tmp = t_0 elif d4 <= 4.5e+68: tmp = t_1 else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d1)) t_1 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d4 <= -4.8e-236) tmp = t_0; elseif (d4 <= 2.3e-245) tmp = t_1; elseif (d4 <= 5e-197) tmp = t_0; elseif (d4 <= 4.5e+68) tmp = t_1; else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d1); t_1 = d1 * (d2 - d3); tmp = 0.0; if (d4 <= -4.8e-236) tmp = t_0; elseif (d4 <= 2.3e-245) tmp = t_1; elseif (d4 <= 5e-197) tmp = t_0; elseif (d4 <= 4.5e+68) tmp = t_1; else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d4, -4.8e-236], t$95$0, If[LessEqual[d4, 2.3e-245], t$95$1, If[LessEqual[d4, 5e-197], t$95$0, If[LessEqual[d4, 4.5e+68], t$95$1, N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq -4.8 \cdot 10^{-236}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 2.3 \cdot 10^{-245}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d4 \leq 5 \cdot 10^{-197}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d4 \leq 4.5 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < -4.80000000000000039e-236 or 2.3000000000000002e-245 < d4 < 5.0000000000000002e-197Initial program 86.8%
associate--l+86.8%
distribute-lft-out--86.8%
distribute-rgt-out--92.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 74.1%
+-commutative74.1%
associate--r+74.1%
Simplified74.1%
Taylor expanded in d3 around 0 56.1%
if -4.80000000000000039e-236 < d4 < 2.3000000000000002e-245 or 5.0000000000000002e-197 < d4 < 4.5000000000000003e68Initial program 92.7%
associate--l+92.7%
distribute-lft-out--92.7%
distribute-rgt-out--92.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 97.7%
+-commutative97.7%
associate--r+97.7%
Simplified97.7%
Taylor expanded in d1 around 0 83.3%
if 4.5000000000000003e68 < d4 Initial program 91.1%
Taylor expanded in d2 around 0 83.0%
distribute-lft-out--87.5%
Simplified87.5%
Taylor expanded in d1 around 0 85.5%
Final simplification70.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 -1.5e-269)
(* d1 (- d2 d1))
(if (<= d4 1.1e-93)
(* d1 (- (- d1) d3))
(if (<= d4 1.85e+65)
(* d1 (- d2 d3))
(if (<= d4 3.1e+116) (* d1 (- d4 d3)) (* d1 (+ d2 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.5e-269) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.1e-93) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 1.85e+65) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3.1e+116) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= (-1.5d-269)) then
tmp = d1 * (d2 - d1)
else if (d4 <= 1.1d-93) then
tmp = d1 * (-d1 - d3)
else if (d4 <= 1.85d+65) then
tmp = d1 * (d2 - d3)
else if (d4 <= 3.1d+116) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= -1.5e-269) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 1.1e-93) {
tmp = d1 * (-d1 - d3);
} else if (d4 <= 1.85e+65) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 3.1e+116) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= -1.5e-269: tmp = d1 * (d2 - d1) elif d4 <= 1.1e-93: tmp = d1 * (-d1 - d3) elif d4 <= 1.85e+65: tmp = d1 * (d2 - d3) elif d4 <= 3.1e+116: tmp = d1 * (d4 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= -1.5e-269) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 1.1e-93) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d4 <= 1.85e+65) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 3.1e+116) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= -1.5e-269) tmp = d1 * (d2 - d1); elseif (d4 <= 1.1e-93) tmp = d1 * (-d1 - d3); elseif (d4 <= 1.85e+65) tmp = d1 * (d2 - d3); elseif (d4 <= 3.1e+116) tmp = d1 * (d4 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, -1.5e-269], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.1e-93], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.85e+65], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 3.1e+116], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq -1.5 \cdot 10^{-269}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 1.1 \cdot 10^{-93}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d4 \leq 1.85 \cdot 10^{+65}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 3.1 \cdot 10^{+116}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < -1.4999999999999999e-269Initial program 87.1%
associate--l+87.1%
distribute-lft-out--87.1%
distribute-rgt-out--92.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 73.1%
+-commutative73.1%
associate--r+73.1%
Simplified73.1%
Taylor expanded in d3 around 0 55.2%
if -1.4999999999999999e-269 < d4 < 1.09999999999999998e-93Initial program 95.8%
associate--l+95.8%
distribute-lft-out--95.8%
distribute-rgt-out--95.8%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around 0 99.9%
+-commutative99.9%
associate--r+99.9%
Simplified99.9%
Taylor expanded in d2 around 0 76.5%
associate-*r*76.5%
neg-mul-176.5%
Simplified76.5%
if 1.09999999999999998e-93 < d4 < 1.84999999999999997e65Initial program 87.2%
associate--l+87.2%
distribute-lft-out--87.2%
distribute-rgt-out--87.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 95.1%
+-commutative95.1%
associate--r+95.1%
Simplified95.1%
Taylor expanded in d1 around 0 82.2%
if 1.84999999999999997e65 < d4 < 3.09999999999999996e116Initial program 99.9%
Taylor expanded in d2 around 0 84.7%
distribute-lft-out--84.7%
Simplified84.7%
Taylor expanded in d1 around 0 84.7%
if 3.09999999999999996e116 < d4 Initial program 87.9%
associate--l+87.9%
distribute-lft-out--87.9%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.2%
Taylor expanded in d1 around 0 85.5%
+-commutative85.5%
Simplified85.5%
Final simplification68.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -7.2e+81) (* d1 (- d2 d3)) (if (<= d3 5.8e+145) (* d1 (- (+ d2 d4) d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -7.2e+81) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 5.8e+145) {
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 <= (-7.2d+81)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 5.8d+145) 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 <= -7.2e+81) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 5.8e+145) {
tmp = d1 * ((d2 + d4) - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -7.2e+81: tmp = d1 * (d2 - d3) elif d3 <= 5.8e+145: tmp = d1 * ((d2 + d4) - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -7.2e+81) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 5.8e+145) 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 <= -7.2e+81) tmp = d1 * (d2 - d3); elseif (d3 <= 5.8e+145) tmp = d1 * ((d2 + d4) - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -7.2e+81], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 5.8e+145], 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 -7.2 \cdot 10^{+81}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 5.8 \cdot 10^{+145}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -7.20000000000000011e81Initial program 87.2%
associate--l+87.2%
distribute-lft-out--87.2%
distribute-rgt-out--87.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 89.8%
+-commutative89.8%
associate--r+89.8%
Simplified89.8%
Taylor expanded in d1 around 0 83.4%
if -7.20000000000000011e81 < d3 < 5.8000000000000001e145Initial program 89.4%
associate--l+89.4%
distribute-lft-out--89.4%
distribute-rgt-out--94.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.8%
if 5.8000000000000001e145 < d3 Initial program 92.3%
Taylor expanded in d2 around 0 83.7%
distribute-lft-out--88.8%
Simplified88.8%
Taylor expanded in d1 around 0 91.4%
Final simplification92.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.22e+115) (not (<= d3 4.1e+153))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.22e+115) || !(d3 <= 4.1e+153)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-1.22d+115)) .or. (.not. (d3 <= 4.1d+153))) then
tmp = d1 * -d3
else
tmp = d1 * (d2 + d4)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.22e+115) || !(d3 <= 4.1e+153)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.22e+115) or not (d3 <= 4.1e+153): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.22e+115) || !(d3 <= 4.1e+153)) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.22e+115) || ~((d3 <= 4.1e+153))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.22e+115], N[Not[LessEqual[d3, 4.1e+153]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.22 \cdot 10^{+115} \lor \neg \left(d3 \leq 4.1 \cdot 10^{+153}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.22e115 or 4.10000000000000017e153 < d3 Initial program 89.6%
associate--l+89.6%
distribute-lft-out--89.6%
distribute-rgt-out--89.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 78.8%
mul-1-neg78.8%
distribute-rgt-neg-out78.8%
Simplified78.8%
if -1.22e115 < d3 < 4.10000000000000017e153Initial program 89.4%
associate--l+89.4%
distribute-lft-out--89.4%
distribute-rgt-out--93.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.5%
Taylor expanded in d1 around 0 70.5%
+-commutative70.5%
Simplified70.5%
Final simplification73.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.65e-294) (* d1 d2) (if (<= d4 1.16e+114) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.65e-294) {
tmp = d1 * d2;
} else if (d4 <= 1.16e+114) {
tmp = d1 * -d3;
} 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 <= 2.65d-294) then
tmp = d1 * d2
else if (d4 <= 1.16d+114) then
tmp = d1 * -d3
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 <= 2.65e-294) {
tmp = d1 * d2;
} else if (d4 <= 1.16e+114) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.65e-294: tmp = d1 * d2 elif d4 <= 1.16e+114: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.65e-294) tmp = Float64(d1 * d2); elseif (d4 <= 1.16e+114) tmp = Float64(d1 * Float64(-d3)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.65e-294) tmp = d1 * d2; elseif (d4 <= 1.16e+114) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.65e-294], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.16e+114], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.65 \cdot 10^{-294}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.16 \cdot 10^{+114}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 2.64999999999999984e-294Initial program 87.0%
associate--l+87.0%
distribute-lft-out--87.0%
distribute-rgt-out--92.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.0%
if 2.64999999999999984e-294 < d4 < 1.15999999999999994e114Initial program 93.4%
associate--l+93.4%
distribute-lft-out--93.4%
distribute-rgt-out--93.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 52.1%
mul-1-neg52.1%
distribute-rgt-neg-out52.1%
Simplified52.1%
if 1.15999999999999994e114 < d4 Initial program 87.9%
associate--l+87.9%
distribute-lft-out--87.9%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 80.1%
Final simplification45.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.8e+111) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.8e+111) {
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 <= 3.8d+111) 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 <= 3.8e+111) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.8e+111: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.8e+111) 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 <= 3.8e+111) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.8e+111], 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 3.8 \cdot 10^{+111}:\\
\;\;\;\;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 < 3.79999999999999976e111Initial program 89.7%
associate--l+89.7%
distribute-lft-out--89.7%
distribute-rgt-out--92.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.3%
+-commutative82.3%
associate--r+82.3%
Simplified82.3%
if 3.79999999999999976e111 < d4 Initial program 87.9%
associate--l+87.9%
distribute-lft-out--87.9%
distribute-rgt-out--90.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.2%
Final simplification83.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -8e-64) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -8e-64) {
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 <= (-8d-64)) 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 <= -8e-64) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -8e-64: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -8e-64) 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 <= -8e-64) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -8e-64], 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 \cdot 10^{-64}:\\
\;\;\;\;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 < -7.99999999999999972e-64Initial program 88.4%
associate--l+88.4%
distribute-lft-out--88.4%
distribute-rgt-out--89.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 87.6%
+-commutative87.6%
associate--r+87.6%
Simplified87.6%
if -7.99999999999999972e-64 < d2 Initial program 89.9%
associate--l+89.9%
distribute-lft-out--89.9%
distribute-rgt-out--93.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 88.1%
+-commutative88.1%
associate--r+88.1%
Simplified88.1%
Final simplification87.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.3e+68) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.3e+68) {
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.3d+68) 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.3e+68) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.3e+68: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.3e+68) 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.3e+68) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.3e+68], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.3 \cdot 10^{+68}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 1.2999999999999999e68Initial program 89.1%
associate--l+89.1%
distribute-lft-out--89.1%
distribute-rgt-out--92.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 33.9%
if 1.2999999999999999e68 < d4 Initial program 91.1%
associate--l+91.1%
distribute-lft-out--91.1%
distribute-rgt-out--93.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 70.1%
Final simplification40.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 89.4%
associate--l+89.4%
distribute-lft-out--89.4%
distribute-rgt-out--92.6%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.2%
Final simplification30.2%
(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 2024075
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))