
(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 (- (+ d4 (- d2 d3)) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 + (d2 - d3)) - 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 * ((d4 + (d2 - d3)) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d4 + (d2 - d3)) - d1);
}
def code(d1, d2, d3, d4): return d1 * ((d4 + (d2 - d3)) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d4 + Float64(d2 - d3)) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d4 + (d2 - d3)) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d4 + N[(d2 - d3), $MachinePrecision]), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d4 + \left(d2 - d3\right)\right) - d1\right)
\end{array}
Initial program 85.9%
+-commutative85.9%
*-commutative85.9%
distribute-lft-out--86.7%
distribute-lft-out90.6%
distribute-lft-out--100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 4.5e-295)
(* d1 d2)
(if (<= d4 3.8e-92)
(* d1 (- d3))
(if (<= d4 1.1e+80) (* d1 (- d1)) (* d1 d4)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.5e-295) {
tmp = d1 * d2;
} else if (d4 <= 3.8e-92) {
tmp = d1 * -d3;
} else if (d4 <= 1.1e+80) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 4.5d-295) then
tmp = d1 * d2
else if (d4 <= 3.8d-92) then
tmp = d1 * -d3
else if (d4 <= 1.1d+80) then
tmp = d1 * -d1
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 4.5e-295) {
tmp = d1 * d2;
} else if (d4 <= 3.8e-92) {
tmp = d1 * -d3;
} else if (d4 <= 1.1e+80) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 4.5e-295: tmp = d1 * d2 elif d4 <= 3.8e-92: tmp = d1 * -d3 elif d4 <= 1.1e+80: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 4.5e-295) tmp = Float64(d1 * d2); elseif (d4 <= 3.8e-92) tmp = Float64(d1 * Float64(-d3)); elseif (d4 <= 1.1e+80) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 4.5e-295) tmp = d1 * d2; elseif (d4 <= 3.8e-92) tmp = d1 * -d3; elseif (d4 <= 1.1e+80) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 4.5e-295], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 3.8e-92], N[(d1 * (-d3)), $MachinePrecision], If[LessEqual[d4, 1.1e+80], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 4.5 \cdot 10^{-295}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 3.8 \cdot 10^{-92}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{elif}\;d4 \leq 1.1 \cdot 10^{+80}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 4.5000000000000002e-295Initial program 84.1%
+-commutative84.1%
*-commutative84.1%
distribute-lft-out--84.8%
distribute-lft-out90.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 30.2%
if 4.5000000000000002e-295 < d4 < 3.8000000000000001e-92Initial program 87.8%
+-commutative87.8%
*-commutative87.8%
distribute-lft-out--87.8%
distribute-lft-out87.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 38.4%
mul-1-neg38.4%
distribute-rgt-neg-out38.4%
Simplified38.4%
if 3.8000000000000001e-92 < d4 < 1.10000000000000001e80Initial program 91.7%
+-commutative91.7%
*-commutative91.7%
distribute-lft-out--91.7%
distribute-lft-out91.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 46.4%
neg-mul-146.4%
Simplified46.4%
if 1.10000000000000001e80 < d4 Initial program 85.1%
+-commutative85.1%
*-commutative85.1%
distribute-lft-out--87.2%
distribute-lft-out91.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 62.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.85e+75) (not (<= d3 3.6e+42))) (* d1 (- (+ d4 d2) d3)) (* d1 (+ d2 (- d4 d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.85e+75) || !(d3 <= 3.6e+42)) {
tmp = d1 * ((d4 + 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 <= (-1.85d+75)) .or. (.not. (d3 <= 3.6d+42))) then
tmp = d1 * ((d4 + 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 <= -1.85e+75) || !(d3 <= 3.6e+42)) {
tmp = d1 * ((d4 + d2) - d3);
} else {
tmp = d1 * (d2 + (d4 - d1));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.85e+75) or not (d3 <= 3.6e+42): tmp = d1 * ((d4 + d2) - d3) else: tmp = d1 * (d2 + (d4 - d1)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.85e+75) || !(d3 <= 3.6e+42)) tmp = Float64(d1 * Float64(Float64(d4 + d2) - d3)); else tmp = Float64(d1 * Float64(d2 + Float64(d4 - d1))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.85e+75) || ~((d3 <= 3.6e+42))) tmp = d1 * ((d4 + d2) - d3); else tmp = d1 * (d2 + (d4 - d1)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.85e+75], N[Not[LessEqual[d3, 3.6e+42]], $MachinePrecision]], N[(d1 * N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.85 \cdot 10^{+75} \lor \neg \left(d3 \leq 3.6 \cdot 10^{+42}\right):\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + \left(d4 - d1\right)\right)\\
\end{array}
\end{array}
if d3 < -1.85000000000000005e75 or 3.6000000000000001e42 < d3 Initial program 80.1%
+-commutative80.1%
*-commutative80.1%
distribute-lft-out--81.9%
distribute-lft-out88.8%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 95.7%
if -1.85000000000000005e75 < d3 < 3.6000000000000001e42Initial program 90.7%
+-commutative90.7%
*-commutative90.7%
distribute-lft-out--90.7%
distribute-lft-out92.1%
distribute-lft-out--100.0%
Simplified100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out94.3%
distribute-lft-out--90.7%
+-commutative90.7%
distribute-lft-out--94.3%
Applied egg-rr94.3%
Taylor expanded in d3 around 0 91.6%
distribute-lft-out97.3%
Simplified97.3%
Final simplification96.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d3 -3.3e+130) (* d1 (- d2 d3)) (if (<= d3 1.7e+127) (* d1 (+ d2 (- d4 d1))) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d3 <= -3.3e+130) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 1.7e+127) {
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 <= (-3.3d+130)) then
tmp = d1 * (d2 - d3)
else if (d3 <= 1.7d+127) 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 <= -3.3e+130) {
tmp = d1 * (d2 - d3);
} else if (d3 <= 1.7e+127) {
tmp = d1 * (d2 + (d4 - d1));
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d3 <= -3.3e+130: tmp = d1 * (d2 - d3) elif d3 <= 1.7e+127: tmp = d1 * (d2 + (d4 - d1)) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d3 <= -3.3e+130) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d3 <= 1.7e+127) tmp = Float64(d1 * Float64(d2 + Float64(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 <= -3.3e+130) tmp = d1 * (d2 - d3); elseif (d3 <= 1.7e+127) tmp = d1 * (d2 + (d4 - d1)); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d3, -3.3e+130], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d3, 1.7e+127], N[(d1 * N[(d2 + N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -3.3 \cdot 10^{+130}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d3 \leq 1.7 \cdot 10^{+127}:\\
\;\;\;\;d1 \cdot \left(d2 + \left(d4 - d1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d3 < -3.3e130Initial program 75.7%
+-commutative75.7%
*-commutative75.7%
distribute-lft-out--75.7%
distribute-lft-out91.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 100.0%
Taylor expanded in d4 around 0 79.2%
if -3.3e130 < d3 < 1.69999999999999989e127Initial program 89.6%
+-commutative89.6%
*-commutative89.6%
distribute-lft-out--90.2%
distribute-lft-out91.9%
distribute-lft-out--100.0%
Simplified100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out93.1%
distribute-lft-out--90.2%
+-commutative90.2%
distribute-lft-out--93.1%
Applied egg-rr93.1%
Taylor expanded in d3 around 0 85.4%
distribute-lft-out91.7%
Simplified91.7%
if 1.69999999999999989e127 < d3 Initial program 80.0%
+-commutative80.0%
*-commutative80.0%
distribute-lft-out--82.2%
distribute-lft-out84.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 97.8%
Taylor expanded in d2 around 0 78.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.8e-117) (* d1 (- d2 d3)) (if (<= d4 1.42e+81) (* d1 (- (- d1) d3)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.8e-117) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.42e+81) {
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 <= 3.8d-117) then
tmp = d1 * (d2 - d3)
else if (d4 <= 1.42d+81) 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 <= 3.8e-117) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.42e+81) {
tmp = d1 * (-d1 - d3);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.8e-117: tmp = d1 * (d2 - d3) elif d4 <= 1.42e+81: tmp = d1 * (-d1 - d3) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.8e-117) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 1.42e+81) 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 <= 3.8e-117) tmp = d1 * (d2 - d3); elseif (d4 <= 1.42e+81) tmp = d1 * (-d1 - d3); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.8e-117], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.42e+81], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.8 \cdot 10^{-117}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 1.42 \cdot 10^{+81}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 3.79999999999999972e-117Initial program 84.9%
+-commutative84.9%
*-commutative84.9%
distribute-lft-out--85.5%
distribute-lft-out90.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.5%
Taylor expanded in d4 around 0 61.0%
if 3.79999999999999972e-117 < d4 < 1.41999999999999998e81Initial program 90.7%
+-commutative90.7%
*-commutative90.7%
distribute-lft-out--90.7%
distribute-lft-out90.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 77.4%
+-commutative77.4%
associate--r+77.4%
Simplified77.4%
Taylor expanded in d4 around 0 66.6%
associate-*r*66.6%
mul-1-neg66.6%
Simplified66.6%
if 1.41999999999999998e81 < d4 Initial program 85.1%
+-commutative85.1%
*-commutative85.1%
distribute-lft-out--87.2%
distribute-lft-out91.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 88.2%
Taylor expanded in d2 around 0 73.7%
Final simplification64.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -1e+48) (not (<= d1 1.3e+84))) (* d1 (- d2 d1)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1e+48) || !(d1 <= 1.3e+84)) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 + d2);
}
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 ((d1 <= (-1d+48)) .or. (.not. (d1 <= 1.3d+84))) then
tmp = d1 * (d2 - d1)
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -1e+48) || !(d1 <= 1.3e+84)) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -1e+48) or not (d1 <= 1.3e+84): tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -1e+48) || !(d1 <= 1.3e+84)) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -1e+48) || ~((d1 <= 1.3e+84))) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -1e+48], N[Not[LessEqual[d1, 1.3e+84]], $MachinePrecision]], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -1 \cdot 10^{+48} \lor \neg \left(d1 \leq 1.3 \cdot 10^{+84}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d1 < -1.00000000000000004e48 or 1.3000000000000001e84 < d1 Initial program 66.9%
+-commutative66.9%
*-commutative66.9%
distribute-lft-out--68.8%
distribute-lft-out78.0%
distribute-lft-out--100.0%
Simplified100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out76.1%
distribute-lft-out--68.8%
+-commutative68.8%
distribute-lft-out--76.1%
Applied egg-rr76.1%
Taylor expanded in d3 around 0 74.2%
distribute-lft-out85.2%
Simplified85.2%
Taylor expanded in d4 around 0 77.9%
if -1.00000000000000004e48 < d1 < 1.3000000000000001e84Initial program 100.0%
+-commutative100.0%
*-commutative100.0%
distribute-lft-out--100.0%
distribute-lft-out100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 98.2%
Taylor expanded in d3 around 0 67.0%
Final simplification71.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d1 -4.1e+151) (not (<= d1 1.2e+89))) (* d1 (- d1)) (* d1 (+ d4 d2))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -4.1e+151) || !(d1 <= 1.2e+89)) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d4 + d2);
}
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 ((d1 <= (-4.1d+151)) .or. (.not. (d1 <= 1.2d+89))) then
tmp = d1 * -d1
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d1 <= -4.1e+151) || !(d1 <= 1.2e+89)) {
tmp = d1 * -d1;
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d1 <= -4.1e+151) or not (d1 <= 1.2e+89): tmp = d1 * -d1 else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d1 <= -4.1e+151) || !(d1 <= 1.2e+89)) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d1 <= -4.1e+151) || ~((d1 <= 1.2e+89))) tmp = d1 * -d1; else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d1, -4.1e+151], N[Not[LessEqual[d1, 1.2e+89]], $MachinePrecision]], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d1 \leq -4.1 \cdot 10^{+151} \lor \neg \left(d1 \leq 1.2 \cdot 10^{+89}\right):\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d1 < -4.0999999999999998e151 or 1.20000000000000002e89 < d1 Initial program 59.3%
+-commutative59.3%
*-commutative59.3%
distribute-lft-out--61.6%
distribute-lft-out72.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 78.2%
neg-mul-178.2%
Simplified78.2%
if -4.0999999999999998e151 < d1 < 1.20000000000000002e89Initial program 99.4%
+-commutative99.4%
*-commutative99.4%
distribute-lft-out--99.4%
distribute-lft-out100.0%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 93.9%
Taylor expanded in d3 around 0 64.2%
Final simplification68.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.45e-90) (* d1 (- d2 d3)) (if (<= d4 1.22e+86) (* d1 (- d4 d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.45e-90) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.22e+86) {
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) :: tmp
if (d4 <= 1.45d-90) then
tmp = d1 * (d2 - d3)
else if (d4 <= 1.22d+86) 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 tmp;
if (d4 <= 1.45e-90) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.22e+86) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.45e-90: tmp = d1 * (d2 - d3) elif d4 <= 1.22e+86: tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.45e-90) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 1.22e+86) 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) tmp = 0.0; if (d4 <= 1.45e-90) tmp = d1 * (d2 - d3); elseif (d4 <= 1.22e+86) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.45e-90], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.22e+86], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.45 \cdot 10^{-90}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 1.22 \cdot 10^{+86}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 1.44999999999999992e-90Initial program 85.0%
+-commutative85.0%
*-commutative85.0%
distribute-lft-out--85.5%
distribute-lft-out90.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.6%
Taylor expanded in d4 around 0 62.1%
if 1.44999999999999992e-90 < d4 < 1.21999999999999996e86Initial program 91.9%
+-commutative91.9%
*-commutative91.9%
distribute-lft-out--91.9%
distribute-lft-out91.9%
distribute-lft-out--100.0%
Simplified100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out91.9%
distribute-lft-out--91.9%
+-commutative91.9%
distribute-lft-out--91.9%
Applied egg-rr91.9%
Taylor expanded in d3 around 0 76.4%
distribute-lft-out81.8%
Simplified81.8%
Taylor expanded in d2 around 0 58.4%
if 1.21999999999999996e86 < d4 Initial program 84.7%
+-commutative84.7%
*-commutative84.7%
distribute-lft-out--86.9%
distribute-lft-out91.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 89.1%
Taylor expanded in d2 around 0 74.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.4e-89) (* d1 (- d2 d3)) (if (<= d4 8.4e+93) (* d1 (- d4 d1)) (* d1 (+ d4 d2)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.4e-89) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 8.4e+93) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 + d2);
}
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.4d-89) then
tmp = d1 * (d2 - d3)
else if (d4 <= 8.4d+93) then
tmp = d1 * (d4 - d1)
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.4e-89) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 8.4e+93) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.4e-89: tmp = d1 * (d2 - d3) elif d4 <= 8.4e+93: tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.4e-89) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 8.4e+93) tmp = Float64(d1 * Float64(d4 - d1)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 3.4e-89) tmp = d1 * (d2 - d3); elseif (d4 <= 8.4e+93) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.4e-89], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 8.4e+93], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.4 \cdot 10^{-89}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 8.4 \cdot 10^{+93}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 3.4e-89Initial program 85.0%
+-commutative85.0%
*-commutative85.0%
distribute-lft-out--85.5%
distribute-lft-out90.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.6%
Taylor expanded in d4 around 0 62.1%
if 3.4e-89 < d4 < 8.39999999999999921e93Initial program 89.7%
+-commutative89.7%
*-commutative89.7%
distribute-lft-out--89.7%
distribute-lft-out89.7%
distribute-lft-out--100.0%
Simplified100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out89.7%
distribute-lft-out--89.7%
+-commutative89.7%
distribute-lft-out--89.7%
Applied egg-rr89.7%
Taylor expanded in d3 around 0 73.9%
distribute-lft-out81.6%
Simplified81.6%
Taylor expanded in d2 around 0 59.4%
if 8.39999999999999921e93 < d4 Initial program 86.4%
+-commutative86.4%
*-commutative86.4%
distribute-lft-out--88.6%
distribute-lft-out93.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 93.2%
Taylor expanded in d3 around 0 80.8%
Final simplification64.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.6e-90) (* d1 (- d2 d3)) (if (<= d4 1.5e+97) (* d1 (- d2 d1)) (* d1 (+ d4 d2)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.6e-90) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.5e+97) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 + d2);
}
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.6d-90) then
tmp = d1 * (d2 - d3)
else if (d4 <= 1.5d+97) then
tmp = d1 * (d2 - d1)
else
tmp = d1 * (d4 + d2)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.6e-90) {
tmp = d1 * (d2 - d3);
} else if (d4 <= 1.5e+97) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d4 + d2);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.6e-90: tmp = d1 * (d2 - d3) elif d4 <= 1.5e+97: tmp = d1 * (d2 - d1) else: tmp = d1 * (d4 + d2) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.6e-90) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d4 <= 1.5e+97) tmp = Float64(d1 * Float64(d2 - d1)); else tmp = Float64(d1 * Float64(d4 + d2)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 3.6e-90) tmp = d1 * (d2 - d3); elseif (d4 <= 1.5e+97) tmp = d1 * (d2 - d1); else tmp = d1 * (d4 + d2); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.6e-90], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d4, 1.5e+97], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 + d2), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.6 \cdot 10^{-90}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d4 \leq 1.5 \cdot 10^{+97}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\end{array}
if d4 < 3.59999999999999981e-90Initial program 85.0%
+-commutative85.0%
*-commutative85.0%
distribute-lft-out--85.5%
distribute-lft-out90.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 82.6%
Taylor expanded in d4 around 0 62.1%
if 3.59999999999999981e-90 < d4 < 1.4999999999999999e97Initial program 89.7%
+-commutative89.7%
*-commutative89.7%
distribute-lft-out--89.7%
distribute-lft-out89.7%
distribute-lft-out--100.0%
Simplified100.0%
+-commutative100.0%
associate--l+100.0%
distribute-lft-out89.7%
distribute-lft-out--89.7%
+-commutative89.7%
distribute-lft-out--89.7%
Applied egg-rr89.7%
Taylor expanded in d3 around 0 73.9%
distribute-lft-out81.6%
Simplified81.6%
Taylor expanded in d4 around 0 69.2%
if 1.4999999999999999e97 < d4 Initial program 86.4%
+-commutative86.4%
*-commutative86.4%
distribute-lft-out--88.6%
distribute-lft-out93.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around 0 93.2%
Taylor expanded in d3 around 0 80.8%
Final simplification66.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.5e-117) (* d1 d2) (if (<= d4 8e+79) (* d1 (- d1)) (* d1 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.5e-117) {
tmp = d1 * d2;
} else if (d4 <= 8e+79) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 3.5d-117) then
tmp = d1 * d2
else if (d4 <= 8d+79) then
tmp = d1 * -d1
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.5e-117) {
tmp = d1 * d2;
} else if (d4 <= 8e+79) {
tmp = d1 * -d1;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.5e-117: tmp = d1 * d2 elif d4 <= 8e+79: tmp = d1 * -d1 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.5e-117) tmp = Float64(d1 * d2); elseif (d4 <= 8e+79) tmp = Float64(d1 * Float64(-d1)); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 3.5e-117) tmp = d1 * d2; elseif (d4 <= 8e+79) tmp = d1 * -d1; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.5e-117], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 8e+79], N[(d1 * (-d1)), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.5 \cdot 10^{-117}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 8 \cdot 10^{+79}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 3.4999999999999998e-117Initial program 84.9%
+-commutative84.9%
*-commutative84.9%
distribute-lft-out--85.5%
distribute-lft-out90.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 32.2%
if 3.4999999999999998e-117 < d4 < 7.99999999999999974e79Initial program 90.7%
+-commutative90.7%
*-commutative90.7%
distribute-lft-out--90.7%
distribute-lft-out90.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 43.9%
neg-mul-143.9%
Simplified43.9%
if 7.99999999999999974e79 < d4 Initial program 85.1%
+-commutative85.1%
*-commutative85.1%
distribute-lft-out--87.2%
distribute-lft-out91.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 62.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -5.8e-31) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.8e-31) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-5.8d-31)) then
tmp = d1 * d2
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -5.8e-31) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -5.8e-31: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -5.8e-31) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -5.8e-31) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -5.8e-31], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -5.8 \cdot 10^{-31}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -5.8000000000000001e-31Initial program 80.3%
+-commutative80.3%
*-commutative80.3%
distribute-lft-out--80.3%
distribute-lft-out83.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 51.8%
if -5.8000000000000001e-31 < d2 Initial program 88.1%
+-commutative88.1%
*-commutative88.1%
distribute-lft-out--89.2%
distribute-lft-out93.5%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 30.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.5e-113) (* d1 d2) (* d1 d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.5e-113) {
tmp = d1 * d2;
} else {
tmp = d1 * 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 <= (-2.5d-113)) then
tmp = d1 * d2
else
tmp = d1 * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.5e-113) {
tmp = d1 * d2;
} else {
tmp = d1 * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.5e-113: tmp = d1 * d2 else: tmp = d1 * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.5e-113) tmp = Float64(d1 * d2); else tmp = Float64(d1 * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.5e-113) tmp = d1 * d2; else tmp = d1 * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.5e-113], N[(d1 * d2), $MachinePrecision], N[(d1 * d1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.5 \cdot 10^{-113}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d1\\
\end{array}
\end{array}
if d2 < -2.4999999999999999e-113Initial program 82.8%
+-commutative82.8%
*-commutative82.8%
distribute-lft-out--82.8%
distribute-lft-out86.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 42.8%
if -2.4999999999999999e-113 < d2 Initial program 87.5%
+-commutative87.5%
*-commutative87.5%
distribute-lft-out--88.7%
distribute-lft-out92.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 35.1%
neg-mul-135.1%
Simplified35.1%
neg-sub035.1%
sub-neg35.1%
add-sqr-sqrt20.0%
sqrt-unprod23.3%
sqr-neg23.3%
sqrt-unprod3.3%
add-sqr-sqrt6.1%
Applied egg-rr6.1%
+-lft-identity6.1%
Simplified6.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 d1))
double code(double d1, double d2, double d3, double d4) {
return 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 * d1
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * d1;
}
def code(d1, d2, d3, d4): return d1 * d1
function code(d1, d2, d3, d4) return Float64(d1 * d1) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * d1; end
code[d1_, d2_, d3_, d4_] := N[(d1 * d1), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot d1
\end{array}
Initial program 85.9%
+-commutative85.9%
*-commutative85.9%
distribute-lft-out--86.7%
distribute-lft-out90.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d1 around inf 31.6%
neg-mul-131.6%
Simplified31.6%
neg-sub031.6%
sub-neg31.6%
add-sqr-sqrt18.6%
sqrt-unprod21.5%
sqr-neg21.5%
sqrt-unprod2.9%
add-sqr-sqrt7.1%
Applied egg-rr7.1%
+-lft-identity7.1%
Simplified7.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (- (+ (- d2 d3) d4) d1)))
double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (((d2 - d3) + d4) - d1)
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (((d2 - d3) + d4) - d1);
}
def code(d1, d2, d3, d4): return d1 * (((d2 - d3) + d4) - d1)
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(Float64(d2 - d3) + d4) - d1)) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (((d2 - d3) + d4) - d1); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(N[(d2 - d3), $MachinePrecision] + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(\left(d2 - d3\right) + d4\right) - d1\right)
\end{array}
herbie shell --seed 2024165
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:alt
(! :herbie-platform default (* d1 (- (+ (- d2 d3) d4) d1)))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))