
(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 88.3%
associate--l+88.3%
distribute-lft-out--89.4%
distribute-rgt-out--90.2%
distribute-lft-out100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d1))) (t_1 (* d1 (- d2 d3))))
(if (<= d1 -1.1e-17)
t_0
(if (<= d1 3e-178)
t_1
(if (<= d1 4.1e+27) (* d1 (+ d2 d4)) (if (<= d1 2.7e+134) t_1 t_0))))))
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 (d1 <= -1.1e-17) {
tmp = t_0;
} else if (d1 <= 3e-178) {
tmp = t_1;
} else if (d1 <= 4.1e+27) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 2.7e+134) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = d1 * (d2 - d1)
t_1 = d1 * (d2 - d3)
if (d1 <= (-1.1d-17)) then
tmp = t_0
else if (d1 <= 3d-178) then
tmp = t_1
else if (d1 <= 4.1d+27) then
tmp = d1 * (d2 + d4)
else if (d1 <= 2.7d+134) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d1);
double t_1 = d1 * (d2 - d3);
double tmp;
if (d1 <= -1.1e-17) {
tmp = t_0;
} else if (d1 <= 3e-178) {
tmp = t_1;
} else if (d1 <= 4.1e+27) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 2.7e+134) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d1) t_1 = d1 * (d2 - d3) tmp = 0 if d1 <= -1.1e-17: tmp = t_0 elif d1 <= 3e-178: tmp = t_1 elif d1 <= 4.1e+27: tmp = d1 * (d2 + d4) elif d1 <= 2.7e+134: tmp = t_1 else: tmp = t_0 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 (d1 <= -1.1e-17) tmp = t_0; elseif (d1 <= 3e-178) tmp = t_1; elseif (d1 <= 4.1e+27) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d1 <= 2.7e+134) tmp = t_1; else tmp = t_0; 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 (d1 <= -1.1e-17) tmp = t_0; elseif (d1 <= 3e-178) tmp = t_1; elseif (d1 <= 4.1e+27) tmp = d1 * (d2 + d4); elseif (d1 <= 2.7e+134) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -1.1e-17], t$95$0, If[LessEqual[d1, 3e-178], t$95$1, If[LessEqual[d1, 4.1e+27], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 2.7e+134], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d1 \leq -1.1 \cdot 10^{-17}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d1 \leq 3 \cdot 10^{-178}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;d1 \leq 4.1 \cdot 10^{+27}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d1 \leq 2.7 \cdot 10^{+134}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d1 < -1.1e-17 or 2.7e134 < d1 Initial program 72.4%
associate--l+72.4%
distribute-lft-out--75.2%
distribute-rgt-out--77.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 92.4%
Taylor expanded in d4 around 0 78.5%
if -1.1e-17 < d1 < 2.9999999999999999e-178 or 4.1000000000000002e27 < d1 < 2.7e134Initial program 99.1%
associate--l+99.1%
distribute-lft-out--99.1%
distribute-rgt-out--99.1%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in99.1%
Applied egg-rr99.1%
Taylor expanded in d1 around 0 96.4%
Taylor expanded in d4 around 0 66.8%
if 2.9999999999999999e-178 < d1 < 4.1000000000000002e27Initial 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 0 75.6%
Taylor expanded in d1 around 0 69.1%
Final simplification72.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d2 d3))))
(if (<= d1 -1.02e-17)
(* d1 (- d2 d1))
(if (<= d1 1.8e-174)
t_0
(if (<= d1 1.7e+26)
(* d1 (+ d2 d4))
(if (<= d1 2.7e+134) t_0 (* d1 (- d4 d1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d1 <= -1.02e-17) {
tmp = d1 * (d2 - d1);
} else if (d1 <= 1.8e-174) {
tmp = t_0;
} else if (d1 <= 1.7e+26) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 2.7e+134) {
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 - d3)
if (d1 <= (-1.02d-17)) then
tmp = d1 * (d2 - d1)
else if (d1 <= 1.8d-174) then
tmp = t_0
else if (d1 <= 1.7d+26) then
tmp = d1 * (d2 + d4)
else if (d1 <= 2.7d+134) 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 - d3);
double tmp;
if (d1 <= -1.02e-17) {
tmp = d1 * (d2 - d1);
} else if (d1 <= 1.8e-174) {
tmp = t_0;
} else if (d1 <= 1.7e+26) {
tmp = d1 * (d2 + d4);
} else if (d1 <= 2.7e+134) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d1 <= -1.02e-17: tmp = d1 * (d2 - d1) elif d1 <= 1.8e-174: tmp = t_0 elif d1 <= 1.7e+26: tmp = d1 * (d2 + d4) elif d1 <= 2.7e+134: tmp = t_0 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d1 <= -1.02e-17) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d1 <= 1.8e-174) tmp = t_0; elseif (d1 <= 1.7e+26) tmp = Float64(d1 * Float64(d2 + d4)); elseif (d1 <= 2.7e+134) 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 - d3); tmp = 0.0; if (d1 <= -1.02e-17) tmp = d1 * (d2 - d1); elseif (d1 <= 1.8e-174) tmp = t_0; elseif (d1 <= 1.7e+26) tmp = d1 * (d2 + d4); elseif (d1 <= 2.7e+134) 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 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -1.02e-17], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 1.8e-174], t$95$0, If[LessEqual[d1, 1.7e+26], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 2.7e+134], t$95$0, N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d1 \leq -1.02 \cdot 10^{-17}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d1 \leq 1.8 \cdot 10^{-174}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d1 \leq 1.7 \cdot 10^{+26}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{elif}\;d1 \leq 2.7 \cdot 10^{+134}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d1 < -1.01999999999999997e-17Initial program 76.9%
associate--l+76.9%
distribute-lft-out--80.0%
distribute-rgt-out--81.5%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 87.8%
Taylor expanded in d4 around 0 68.3%
if -1.01999999999999997e-17 < d1 < 1.79999999999999999e-174 or 1.7000000000000001e26 < d1 < 2.7e134Initial program 99.1%
associate--l+99.1%
distribute-lft-out--99.1%
distribute-rgt-out--99.1%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in99.1%
Applied egg-rr99.1%
Taylor expanded in d1 around 0 96.4%
Taylor expanded in d4 around 0 66.8%
if 1.79999999999999999e-174 < d1 < 1.7000000000000001e26Initial 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 0 75.6%
Taylor expanded in d1 around 0 69.1%
if 2.7e134 < d1 Initial program 65.0%
associate--l+65.0%
distribute-lft-out--67.5%
distribute-rgt-out--70.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d2 around 0 92.3%
Final simplification71.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d3))))
(if (<= d1 -6.8e-56)
(* d1 (- d2 d1))
(if (<= d1 -7.5e-264)
t_0
(if (<= d1 1.3e-165)
(* d1 (- d2 d3))
(if (<= d1 2.4e+134) t_0 (* d1 (- d4 d1))))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d3);
double tmp;
if (d1 <= -6.8e-56) {
tmp = d1 * (d2 - d1);
} else if (d1 <= -7.5e-264) {
tmp = t_0;
} else if (d1 <= 1.3e-165) {
tmp = d1 * (d2 - d3);
} else if (d1 <= 2.4e+134) {
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 * (d4 - d3)
if (d1 <= (-6.8d-56)) then
tmp = d1 * (d2 - d1)
else if (d1 <= (-7.5d-264)) then
tmp = t_0
else if (d1 <= 1.3d-165) then
tmp = d1 * (d2 - d3)
else if (d1 <= 2.4d+134) 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 * (d4 - d3);
double tmp;
if (d1 <= -6.8e-56) {
tmp = d1 * (d2 - d1);
} else if (d1 <= -7.5e-264) {
tmp = t_0;
} else if (d1 <= 1.3e-165) {
tmp = d1 * (d2 - d3);
} else if (d1 <= 2.4e+134) {
tmp = t_0;
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d3) tmp = 0 if d1 <= -6.8e-56: tmp = d1 * (d2 - d1) elif d1 <= -7.5e-264: tmp = t_0 elif d1 <= 1.3e-165: tmp = d1 * (d2 - d3) elif d1 <= 2.4e+134: tmp = t_0 else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d3)) tmp = 0.0 if (d1 <= -6.8e-56) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d1 <= -7.5e-264) tmp = t_0; elseif (d1 <= 1.3e-165) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d1 <= 2.4e+134) 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 * (d4 - d3); tmp = 0.0; if (d1 <= -6.8e-56) tmp = d1 * (d2 - d1); elseif (d1 <= -7.5e-264) tmp = t_0; elseif (d1 <= 1.3e-165) tmp = d1 * (d2 - d3); elseif (d1 <= 2.4e+134) 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[(d4 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d1, -6.8e-56], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, -7.5e-264], t$95$0, If[LessEqual[d1, 1.3e-165], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d1, 2.4e+134], t$95$0, N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d3\right)\\
\mathbf{if}\;d1 \leq -6.8 \cdot 10^{-56}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d1 \leq -7.5 \cdot 10^{-264}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d1 \leq 1.3 \cdot 10^{-165}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d1 \leq 2.4 \cdot 10^{+134}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d1 < -6.79999999999999964e-56Initial program 80.0%
associate--l+80.0%
distribute-lft-out--82.6%
distribute-rgt-out--84.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 88.0%
Taylor expanded in d4 around 0 63.4%
if -6.79999999999999964e-56 < d1 < -7.5000000000000001e-264 or 1.30000000000000004e-165 < d1 < 2.40000000000000005e134Initial program 98.9%
associate--l+98.9%
distribute-lft-out--98.9%
distribute-rgt-out--98.9%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in98.9%
Applied egg-rr98.9%
Taylor expanded in d1 around 0 92.8%
Taylor expanded in d2 around 0 68.5%
if -7.5000000000000001e-264 < d1 < 1.30000000000000004e-165Initial program 100.0%
associate--l+100.0%
distribute-lft-out--100.0%
distribute-rgt-out--100.0%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d4 around 0 66.9%
if 2.40000000000000005e134 < d1 Initial program 65.0%
associate--l+65.0%
distribute-lft-out--67.5%
distribute-rgt-out--70.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 100.0%
Taylor expanded in d2 around 0 92.3%
Final simplification70.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -2.7e+72) (not (<= d3 1.35e+89))) (* d1 (- d2 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -2.7e+72) || !(d3 <= 1.35e+89)) {
tmp = d1 * (d2 - 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.7d+72)) .or. (.not. (d3 <= 1.35d+89))) then
tmp = d1 * (d2 - 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.7e+72) || !(d3 <= 1.35e+89)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -2.7e+72) or not (d3 <= 1.35e+89): tmp = d1 * (d2 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -2.7e+72) || !(d3 <= 1.35e+89)) tmp = Float64(d1 * Float64(d2 - 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.7e+72) || ~((d3 <= 1.35e+89))) tmp = d1 * (d2 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -2.7e+72], N[Not[LessEqual[d3, 1.35e+89]], $MachinePrecision]], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -2.7 \cdot 10^{+72} \lor \neg \left(d3 \leq 1.35 \cdot 10^{+89}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -2.7000000000000001e72 or 1.35e89 < d3 Initial program 84.2%
associate--l+84.2%
distribute-lft-out--87.4%
distribute-rgt-out--89.5%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in89.5%
Applied egg-rr89.5%
Taylor expanded in d1 around 0 92.6%
Taylor expanded in d4 around 0 81.7%
if -2.7000000000000001e72 < d3 < 1.35e89Initial program 90.7%
associate--l+90.7%
distribute-lft-out--90.7%
distribute-rgt-out--90.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.5%
Final simplification91.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -9e+70) (not (<= d3 4.8e+29))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -9e+70) || !(d3 <= 4.8e+29)) {
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 <= (-9d+70)) .or. (.not. (d3 <= 4.8d+29))) 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 <= -9e+70) || !(d3 <= 4.8e+29)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -9e+70) or not (d3 <= 4.8e+29): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -9e+70) || !(d3 <= 4.8e+29)) 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 <= -9e+70) || ~((d3 <= 4.8e+29))) 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, -9e+70], N[Not[LessEqual[d3, 4.8e+29]], $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 -9 \cdot 10^{+70} \lor \neg \left(d3 \leq 4.8 \cdot 10^{+29}\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 < -8.9999999999999999e70 or 4.8000000000000002e29 < d3 Initial program 83.6%
associate--l+83.6%
distribute-lft-out--86.5%
distribute-rgt-out--88.4%
distribute-lft-out100.0%
Simplified100.0%
+-commutative100.0%
distribute-lft-in88.4%
Applied egg-rr88.4%
Taylor expanded in d1 around 0 93.3%
if -8.9999999999999999e70 < d3 < 4.8000000000000002e29Initial program 91.4%
associate--l+91.4%
distribute-lft-out--91.4%
distribute-rgt-out--91.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 98.1%
Final simplification96.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.25e-306) (* d1 (- d2 d1)) (if (<= d4 118000000.0) (* d1 (- (- d1) d3)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.25e-306) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 118000000.0) {
tmp = d1 * (-d1 - d3);
} 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 <= 1.25d-306) then
tmp = d1 * (d2 - d1)
else if (d4 <= 118000000.0d0) then
tmp = d1 * (-d1 - d3)
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 <= 1.25e-306) {
tmp = d1 * (d2 - d1);
} else if (d4 <= 118000000.0) {
tmp = d1 * (-d1 - d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.25e-306: tmp = d1 * (d2 - d1) elif d4 <= 118000000.0: tmp = d1 * (-d1 - d3) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.25e-306) tmp = Float64(d1 * Float64(d2 - d1)); elseif (d4 <= 118000000.0) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); else tmp = Float64(d1 * Float64(d4 - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.25e-306) tmp = d1 * (d2 - d1); elseif (d4 <= 118000000.0) tmp = d1 * (-d1 - d3); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.25e-306], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 118000000.0], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.25 \cdot 10^{-306}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 118000000:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 1.25e-306Initial program 86.0%
associate--l+86.0%
distribute-lft-out--88.3%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 73.2%
Taylor expanded in d4 around 0 49.4%
if 1.25e-306 < d4 < 1.18e8Initial program 91.8%
associate--l+91.8%
distribute-lft-out--91.8%
distribute-rgt-out--91.8%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around 0 78.2%
+-commutative78.2%
associate--r+78.2%
Simplified78.2%
Taylor expanded in d4 around 0 78.2%
associate-*r*78.2%
neg-mul-178.2%
Simplified78.2%
if 1.18e8 < d4 Initial program 88.9%
associate--l+88.9%
distribute-lft-out--88.9%
distribute-rgt-out--90.7%
distribute-lft-out99.9%
Simplified99.9%
+-commutative99.9%
distribute-lft-in90.7%
Applied egg-rr90.7%
Taylor expanded in d1 around 0 91.6%
Taylor expanded in d2 around 0 80.5%
Final simplification64.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.5e+70) (not (<= d3 1.65e+145))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.5e+70) || !(d3 <= 1.65e+145)) {
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.5d+70)) .or. (.not. (d3 <= 1.65d+145))) 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.5e+70) || !(d3 <= 1.65e+145)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.5e+70) or not (d3 <= 1.65e+145): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.5e+70) || !(d3 <= 1.65e+145)) 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.5e+70) || ~((d3 <= 1.65e+145))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.5e+70], N[Not[LessEqual[d3, 1.65e+145]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.5 \cdot 10^{+70} \lor \neg \left(d3 \leq 1.65 \cdot 10^{+145}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.49999999999999988e70 or 1.65000000000000013e145 < d3 Initial program 83.3%
associate--l+83.3%
distribute-lft-out--86.9%
distribute-rgt-out--89.3%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around inf 79.4%
mul-1-neg79.4%
*-commutative79.4%
distribute-rgt-neg-in79.4%
Simplified79.4%
if -1.49999999999999988e70 < d3 < 1.65000000000000013e145Initial program 90.7%
associate--l+90.7%
distribute-lft-out--90.7%
distribute-rgt-out--90.7%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 94.8%
Taylor expanded in d1 around 0 68.0%
Final simplification71.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 6.9e-307) (* d1 d2) (if (<= d4 1.05e+49) (* d1 (- d3)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6.9e-307) {
tmp = d1 * d2;
} else if (d4 <= 1.05e+49) {
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 <= 6.9d-307) then
tmp = d1 * d2
else if (d4 <= 1.05d+49) 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 <= 6.9e-307) {
tmp = d1 * d2;
} else if (d4 <= 1.05e+49) {
tmp = d1 * -d3;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 6.9e-307: tmp = d1 * d2 elif d4 <= 1.05e+49: tmp = d1 * -d3 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 6.9e-307) tmp = Float64(d1 * d2); elseif (d4 <= 1.05e+49) 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 <= 6.9e-307) tmp = d1 * d2; elseif (d4 <= 1.05e+49) tmp = d1 * -d3; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 6.9e-307], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.05e+49], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 6.9 \cdot 10^{-307}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.05 \cdot 10^{+49}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 6.8999999999999997e-307Initial program 86.0%
associate--l+86.0%
distribute-lft-out--88.3%
distribute-rgt-out--89.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 26.2%
if 6.8999999999999997e-307 < d4 < 1.05000000000000005e49Initial program 92.2%
associate--l+92.2%
distribute-lft-out--92.2%
distribute-rgt-out--92.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around inf 40.3%
mul-1-neg40.3%
*-commutative40.3%
distribute-rgt-neg-in40.3%
Simplified40.3%
if 1.05000000000000005e49 < d4 Initial program 88.0%
associate--l+88.0%
distribute-lft-out--88.0%
distribute-rgt-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around inf 67.2%
Final simplification38.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 33000000.0) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 33000000.0) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d2 + 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 <= 33000000.0d0) then
tmp = d1 * ((d2 - d3) - d1)
else
tmp = d1 * ((d2 + d4) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 33000000.0) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 33000000.0: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 33000000.0) tmp = Float64(d1 * Float64(Float64(d2 - d3) - d1)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 33000000.0) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 33000000.0], N[(d1 * N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 33000000:\\
\;\;\;\;d1 \cdot \left(\left(d2 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\end{array}
if d4 < 3.3e7Initial program 88.1%
associate--l+88.1%
distribute-lft-out--89.6%
distribute-rgt-out--90.1%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 84.1%
+-commutative84.1%
associate--r+84.1%
Simplified84.1%
if 3.3e7 < d4 Initial program 88.9%
associate--l+88.9%
distribute-lft-out--88.9%
distribute-rgt-out--90.7%
distribute-lft-out99.9%
Simplified99.9%
+-commutative99.9%
distribute-lft-in90.7%
Applied egg-rr90.7%
Taylor expanded in d1 around 0 91.6%
Final simplification85.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.45e-13) (* d1 (- (- d2 d3) d1)) (* d1 (- (- d4 d3) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.45e-13) {
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 <= 1.45d-13) 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 <= 1.45e-13) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d4 - d3) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.45e-13: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d4 - d3) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.45e-13) 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 <= 1.45e-13) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d4 - d3) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.45e-13], 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 1.45 \cdot 10^{-13}:\\
\;\;\;\;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 < 1.4499999999999999e-13Initial program 88.4%
associate--l+88.4%
distribute-lft-out--89.9%
distribute-rgt-out--90.4%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d4 around 0 83.8%
+-commutative83.8%
associate--r+83.8%
Simplified83.8%
if 1.4499999999999999e-13 < d4 Initial program 87.9%
associate--l+87.9%
distribute-lft-out--87.9%
distribute-rgt-out--89.7%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d2 around 0 89.6%
+-commutative89.6%
associate--r+89.6%
Simplified89.6%
Final simplification85.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 9500.0) (* d1 (- d2 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 9500.0) {
tmp = d1 * (d2 - d1);
} 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 <= 9500.0d0) then
tmp = d1 * (d2 - d1)
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 <= 9500.0) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 9500.0: tmp = d1 * (d2 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 9500.0) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d2 + d4)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 9500.0) tmp = d1 * (d2 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 9500.0], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 9500:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 9500Initial program 88.0%
associate--l+88.0%
distribute-lft-out--89.5%
distribute-rgt-out--90.0%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d3 around 0 73.1%
Taylor expanded in d4 around 0 57.8%
if 9500 < d4 Initial program 89.1%
associate--l+89.1%
distribute-lft-out--89.1%
distribute-rgt-out--90.9%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d3 around 0 84.0%
Taylor expanded in d1 around 0 74.1%
Final simplification61.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.5e-12) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.5e-12) {
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 <= 3.5d-12) 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 <= 3.5e-12) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.5e-12: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.5e-12) 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 <= 3.5e-12) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.5e-12], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.5 \cdot 10^{-12}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 3.5e-12Initial program 87.9%
associate--l+87.9%
distribute-lft-out--89.4%
distribute-rgt-out--89.9%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 29.7%
if 3.5e-12 < d4 Initial program 89.5%
associate--l+89.5%
distribute-lft-out--89.5%
distribute-rgt-out--91.2%
distribute-lft-out99.9%
Simplified99.9%
Taylor expanded in d4 around inf 61.1%
Final simplification36.7%
(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 88.3%
associate--l+88.3%
distribute-lft-out--89.4%
distribute-rgt-out--90.2%
distribute-lft-out100.0%
Simplified100.0%
Taylor expanded in d2 around inf 27.0%
Final simplification27.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ (- d2 d3) d4) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (((d2 - d3) + d4) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
def code(d1, d2, d3, d4): return d1 * (((d2 - d3) + d4) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(Float64(d2 - d3) + d4) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (((d2 - d3) + d4) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(N[(d2 - d3), $MachinePrecision] + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)
\end{array}
herbie shell --seed 2024043
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))