
(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 d1) (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
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) + (d4 - d3))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * ((d2 - d1) + (d4 - d3));
}
def code(d1, d2, d3, d4): return d1 * ((d2 - d1) + (d4 - d3))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(Float64(d2 - d1) + Float64(d4 - d3))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * ((d2 - d1) + (d4 - d3)); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(N[(d2 - d1), $MachinePrecision] + N[(d4 - d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(\left(d2 - d1\right) + \left(d4 - d3\right)\right)
\end{array}
Initial program 87.5%
sub-neg87.5%
+-commutative87.5%
associate-+r+87.5%
+-commutative87.5%
sub-neg87.5%
+-commutative87.5%
associate-+r+87.5%
sub-neg87.5%
*-commutative87.5%
+-commutative87.5%
unsub-neg87.5%
associate--r-87.5%
distribute-rgt-out--91.0%
*-commutative91.0%
distribute-lft-out--92.6%
distribute-lft-out--100.0%
Simplified100.0%
Final simplification100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d4 d1))))
(if (<= d2 -5.4e-73)
(* d1 (- d2 d3))
(if (<= d2 -7.5e-178)
t_0
(if (<= d2 -4.8e-294)
(* d1 (- (- d1) d3))
(if (<= d2 1.04e-75) (* d1 (- d4 d3)) t_0))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d4 - d1);
double tmp;
if (d2 <= -5.4e-73) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -7.5e-178) {
tmp = t_0;
} else if (d2 <= -4.8e-294) {
tmp = d1 * (-d1 - d3);
} else if (d2 <= 1.04e-75) {
tmp = d1 * (d4 - d3);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * (d4 - d1)
if (d2 <= (-5.4d-73)) then
tmp = d1 * (d2 - d3)
else if (d2 <= (-7.5d-178)) then
tmp = t_0
else if (d2 <= (-4.8d-294)) then
tmp = d1 * (-d1 - d3)
else if (d2 <= 1.04d-75) then
tmp = d1 * (d4 - d3)
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 * (d4 - d1);
double tmp;
if (d2 <= -5.4e-73) {
tmp = d1 * (d2 - d3);
} else if (d2 <= -7.5e-178) {
tmp = t_0;
} else if (d2 <= -4.8e-294) {
tmp = d1 * (-d1 - d3);
} else if (d2 <= 1.04e-75) {
tmp = d1 * (d4 - d3);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d4 - d1) tmp = 0 if d2 <= -5.4e-73: tmp = d1 * (d2 - d3) elif d2 <= -7.5e-178: tmp = t_0 elif d2 <= -4.8e-294: tmp = d1 * (-d1 - d3) elif d2 <= 1.04e-75: tmp = d1 * (d4 - d3) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d4 - d1)) tmp = 0.0 if (d2 <= -5.4e-73) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= -7.5e-178) tmp = t_0; elseif (d2 <= -4.8e-294) tmp = Float64(d1 * Float64(Float64(-d1) - d3)); elseif (d2 <= 1.04e-75) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d4 - d1); tmp = 0.0; if (d2 <= -5.4e-73) tmp = d1 * (d2 - d3); elseif (d2 <= -7.5e-178) tmp = t_0; elseif (d2 <= -4.8e-294) tmp = d1 * (-d1 - d3); elseif (d2 <= 1.04e-75) tmp = d1 * (d4 - d3); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d2, -5.4e-73], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, -7.5e-178], t$95$0, If[LessEqual[d2, -4.8e-294], N[(d1 * N[((-d1) - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, 1.04e-75], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d1\right)\\
\mathbf{if}\;d2 \leq -5.4 \cdot 10^{-73}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -7.5 \cdot 10^{-178}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -4.8 \cdot 10^{-294}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d2 \leq 1.04 \cdot 10^{-75}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if d2 < -5.39999999999999989e-73Initial program 86.0%
sub-neg86.0%
+-commutative86.0%
associate-+r+86.0%
+-commutative86.0%
sub-neg86.0%
+-commutative86.0%
associate-+r+86.0%
sub-neg86.0%
*-commutative86.0%
+-commutative86.0%
unsub-neg86.0%
associate--r-86.0%
distribute-rgt-out--91.1%
*-commutative91.1%
distribute-lft-out--93.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 80.4%
+-commutative80.4%
associate--r+80.4%
Simplified80.4%
Taylor expanded in d1 around 0 76.5%
if -5.39999999999999989e-73 < d2 < -7.50000000000000019e-178 or 1.04e-75 < d2 Initial program 83.6%
sub-neg83.6%
+-commutative83.6%
associate-+r+83.6%
+-commutative83.6%
sub-neg83.6%
+-commutative83.6%
associate-+r+83.6%
sub-neg83.6%
*-commutative83.6%
+-commutative83.6%
unsub-neg83.6%
associate--r-83.6%
distribute-rgt-out--88.4%
*-commutative88.4%
distribute-lft-out--90.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 78.2%
associate--r+78.2%
Simplified78.2%
Taylor expanded in d3 around 0 62.3%
if -7.50000000000000019e-178 < d2 < -4.79999999999999994e-294Initial program 96.3%
sub-neg96.3%
+-commutative96.3%
associate-+r+96.3%
+-commutative96.3%
sub-neg96.3%
+-commutative96.3%
associate-+r+96.3%
sub-neg96.3%
*-commutative96.3%
+-commutative96.3%
unsub-neg96.3%
associate--r-96.3%
distribute-rgt-out--96.3%
*-commutative96.3%
distribute-lft-out--96.3%
distribute-lft-out--99.9%
Simplified99.9%
Taylor expanded in d4 around 0 81.1%
+-commutative81.1%
associate--r+81.1%
Simplified81.1%
Taylor expanded in d2 around 0 81.1%
mul-1-neg81.1%
distribute-rgt-neg-in81.1%
Simplified81.1%
if -4.79999999999999994e-294 < d2 < 1.04e-75Initial program 93.5%
associate--l+93.5%
distribute-lft-out--93.5%
*-commutative93.5%
Simplified93.5%
+-commutative93.5%
distribute-lft-out--93.5%
fma-def100.0%
Applied egg-rr100.0%
Taylor expanded in d1 around 0 84.4%
Taylor expanded in d2 around 0 84.3%
Final simplification72.6%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (* d1 (- d3))))
(if (<= d4 6.5e-278)
(* d1 d2)
(if (<= d4 1.7e-153)
t_0
(if (<= d4 1.25e-63) (* d1 d2) (if (<= d4 3.4e+64) t_0 (* d1 d4)))))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d4 <= 6.5e-278) {
tmp = d1 * d2;
} else if (d4 <= 1.7e-153) {
tmp = t_0;
} else if (d4 <= 1.25e-63) {
tmp = d1 * d2;
} else if (d4 <= 3.4e+64) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: t_0
real(8) :: tmp
t_0 = d1 * -d3
if (d4 <= 6.5d-278) then
tmp = d1 * d2
else if (d4 <= 1.7d-153) then
tmp = t_0
else if (d4 <= 1.25d-63) then
tmp = d1 * d2
else if (d4 <= 3.4d+64) then
tmp = t_0
else
tmp = d1 * d4
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * -d3;
double tmp;
if (d4 <= 6.5e-278) {
tmp = d1 * d2;
} else if (d4 <= 1.7e-153) {
tmp = t_0;
} else if (d4 <= 1.25e-63) {
tmp = d1 * d2;
} else if (d4 <= 3.4e+64) {
tmp = t_0;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * -d3 tmp = 0 if d4 <= 6.5e-278: tmp = d1 * d2 elif d4 <= 1.7e-153: tmp = t_0 elif d4 <= 1.25e-63: tmp = d1 * d2 elif d4 <= 3.4e+64: tmp = t_0 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(-d3)) tmp = 0.0 if (d4 <= 6.5e-278) tmp = Float64(d1 * d2); elseif (d4 <= 1.7e-153) tmp = t_0; elseif (d4 <= 1.25e-63) tmp = Float64(d1 * d2); elseif (d4 <= 3.4e+64) tmp = t_0; else tmp = Float64(d1 * d4); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * -d3; tmp = 0.0; if (d4 <= 6.5e-278) tmp = d1 * d2; elseif (d4 <= 1.7e-153) tmp = t_0; elseif (d4 <= 1.25e-63) tmp = d1 * d2; elseif (d4 <= 3.4e+64) tmp = t_0; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * (-d3)), $MachinePrecision]}, If[LessEqual[d4, 6.5e-278], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 1.7e-153], t$95$0, If[LessEqual[d4, 1.25e-63], N[(d1 * d2), $MachinePrecision], If[LessEqual[d4, 3.4e+64], t$95$0, N[(d1 * d4), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq 6.5 \cdot 10^{-278}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 1.7 \cdot 10^{-153}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.25 \cdot 10^{-63}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 3.4 \cdot 10^{+64}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d4 < 6.5e-278 or 1.6999999999999999e-153 < d4 < 1.25e-63Initial program 88.6%
sub-neg88.6%
+-commutative88.6%
associate-+r+88.6%
+-commutative88.6%
sub-neg88.6%
+-commutative88.6%
associate-+r+88.6%
sub-neg88.6%
*-commutative88.6%
+-commutative88.6%
unsub-neg88.6%
associate--r-88.6%
distribute-rgt-out--91.8%
*-commutative91.8%
distribute-lft-out--93.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 39.2%
if 6.5e-278 < d4 < 1.6999999999999999e-153 or 1.25e-63 < d4 < 3.4000000000000002e64Initial program 84.8%
sub-neg84.8%
+-commutative84.8%
associate-+r+84.8%
+-commutative84.8%
sub-neg84.8%
+-commutative84.8%
associate-+r+84.8%
sub-neg84.8%
*-commutative84.8%
+-commutative84.8%
unsub-neg84.8%
associate--r-84.8%
distribute-rgt-out--90.5%
*-commutative90.5%
distribute-lft-out--92.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 43.3%
mul-1-neg43.3%
*-commutative43.3%
distribute-rgt-neg-in43.3%
Simplified43.3%
if 3.4000000000000002e64 < d4 Initial program 86.3%
sub-neg86.3%
+-commutative86.3%
associate-+r+86.3%
+-commutative86.3%
sub-neg86.3%
+-commutative86.3%
associate-+r+86.3%
sub-neg86.3%
*-commutative86.3%
+-commutative86.3%
unsub-neg86.3%
associate--r-86.3%
distribute-rgt-out--88.5%
*-commutative88.5%
distribute-lft-out--88.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 63.3%
Final simplification44.2%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -4e+97) (not (<= d3 9e+68))) (* d1 (- d2 d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -4e+97) || !(d3 <= 9e+68)) {
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 <= (-4d+97)) .or. (.not. (d3 <= 9d+68))) 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 <= -4e+97) || !(d3 <= 9e+68)) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -4e+97) or not (d3 <= 9e+68): tmp = d1 * (d2 - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -4e+97) || !(d3 <= 9e+68)) 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 <= -4e+97) || ~((d3 <= 9e+68))) tmp = d1 * (d2 - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -4e+97], N[Not[LessEqual[d3, 9e+68]], $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 -4 \cdot 10^{+97} \lor \neg \left(d3 \leq 9 \cdot 10^{+68}\right):\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d1\right)\\
\end{array}
\end{array}
if d3 < -4.0000000000000003e97 or 9.0000000000000007e68 < d3 Initial program 82.0%
sub-neg82.0%
+-commutative82.0%
associate-+r+82.0%
+-commutative82.0%
sub-neg82.0%
+-commutative82.0%
associate-+r+82.0%
sub-neg82.0%
*-commutative82.0%
+-commutative82.0%
unsub-neg82.0%
associate--r-82.0%
distribute-rgt-out--84.5%
*-commutative84.5%
distribute-lft-out--88.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 88.7%
+-commutative88.7%
associate--r+88.7%
Simplified88.7%
Taylor expanded in d1 around 0 82.1%
if -4.0000000000000003e97 < d3 < 9.0000000000000007e68Initial program 89.9%
sub-neg89.9%
+-commutative89.9%
associate-+r+89.9%
+-commutative89.9%
sub-neg89.9%
+-commutative89.9%
associate-+r+89.9%
sub-neg89.9%
*-commutative89.9%
+-commutative89.9%
unsub-neg89.9%
associate--r-89.9%
distribute-rgt-out--93.8%
*-commutative93.8%
distribute-lft-out--94.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 93.8%
Final simplification90.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -4.2e-64) (not (<= d3 1200000000.0))) (* d1 (- (+ d2 d4) d3)) (* d1 (- (+ d2 d4) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -4.2e-64) || !(d3 <= 1200000000.0)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if ((d3 <= (-4.2d-64)) .or. (.not. (d3 <= 1200000000.0d0))) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * ((d2 + d4) - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -4.2e-64) || !(d3 <= 1200000000.0)) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d2 + d4) - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -4.2e-64) or not (d3 <= 1200000000.0): tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d2 + d4) - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -4.2e-64) || !(d3 <= 1200000000.0)) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(Float64(d2 + d4) - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -4.2e-64) || ~((d3 <= 1200000000.0))) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d2 + d4) - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -4.2e-64], N[Not[LessEqual[d3, 1200000000.0]], $MachinePrecision]], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -4.2 \cdot 10^{-64} \lor \neg \left(d3 \leq 1200000000\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 < -4.20000000000000023e-64 or 1.2e9 < d3 Initial program 86.7%
associate--l+86.7%
distribute-lft-out--87.5%
*-commutative87.5%
Simplified87.5%
+-commutative87.5%
distribute-lft-out--89.1%
fma-def95.3%
Applied egg-rr95.3%
Taylor expanded in d1 around 0 92.7%
if -4.20000000000000023e-64 < d3 < 1.2e9Initial program 88.2%
sub-neg88.2%
+-commutative88.2%
associate-+r+88.2%
+-commutative88.2%
sub-neg88.2%
+-commutative88.2%
associate-+r+88.2%
sub-neg88.2%
*-commutative88.2%
+-commutative88.2%
unsub-neg88.2%
associate--r-88.2%
distribute-rgt-out--93.7%
*-commutative93.7%
distribute-lft-out--93.7%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around 0 97.9%
Final simplification95.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.1e+152) (not (<= d3 1.9e+168))) (* d1 (- d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.1e+152) || !(d3 <= 1.9e+168)) {
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.1d+152)) .or. (.not. (d3 <= 1.9d+168))) 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.1e+152) || !(d3 <= 1.9e+168)) {
tmp = d1 * -d3;
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.1e+152) or not (d3 <= 1.9e+168): tmp = d1 * -d3 else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.1e+152) || !(d3 <= 1.9e+168)) 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.1e+152) || ~((d3 <= 1.9e+168))) tmp = d1 * -d3; else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.1e+152], N[Not[LessEqual[d3, 1.9e+168]], $MachinePrecision]], N[(d1 * (-d3)), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.1 \cdot 10^{+152} \lor \neg \left(d3 \leq 1.9 \cdot 10^{+168}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d3 < -1.0999999999999999e152 or 1.9000000000000001e168 < d3 Initial program 75.4%
sub-neg75.4%
+-commutative75.4%
associate-+r+75.4%
+-commutative75.4%
sub-neg75.4%
+-commutative75.4%
associate-+r+75.4%
sub-neg75.4%
*-commutative75.4%
+-commutative75.4%
unsub-neg75.4%
associate--r-75.4%
distribute-rgt-out--79.2%
*-commutative79.2%
distribute-lft-out--84.9%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d3 around inf 84.9%
mul-1-neg84.9%
*-commutative84.9%
distribute-rgt-neg-in84.9%
Simplified84.9%
if -1.0999999999999999e152 < d3 < 1.9000000000000001e168Initial program 90.6%
associate--l+90.6%
distribute-lft-out--91.1%
*-commutative91.1%
Simplified91.1%
+-commutative91.1%
distribute-lft-out--93.1%
fma-def94.6%
Applied egg-rr94.6%
Taylor expanded in d1 around 0 82.5%
Taylor expanded in d3 around 0 72.4%
+-commutative72.4%
Simplified72.4%
Final simplification75.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -650000000.0) (* d1 (- d2 d3)) (if (<= d2 2.8e-78) (* d1 (- d4 d3)) (* d1 (- d4 d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -650000000.0) {
tmp = d1 * (d2 - d3);
} else if (d2 <= 2.8e-78) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-650000000.0d0)) then
tmp = d1 * (d2 - d3)
else if (d2 <= 2.8d-78) then
tmp = d1 * (d4 - d3)
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -650000000.0) {
tmp = d1 * (d2 - d3);
} else if (d2 <= 2.8e-78) {
tmp = d1 * (d4 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -650000000.0: tmp = d1 * (d2 - d3) elif d2 <= 2.8e-78: tmp = d1 * (d4 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -650000000.0) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= 2.8e-78) tmp = Float64(d1 * Float64(d4 - d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -650000000.0) tmp = d1 * (d2 - d3); elseif (d2 <= 2.8e-78) tmp = d1 * (d4 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -650000000.0], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, 2.8e-78], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -650000000:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq 2.8 \cdot 10^{-78}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -6.5e8Initial program 83.2%
sub-neg83.2%
+-commutative83.2%
associate-+r+83.2%
+-commutative83.2%
sub-neg83.2%
+-commutative83.2%
associate-+r+83.2%
sub-neg83.2%
*-commutative83.2%
+-commutative83.2%
unsub-neg83.2%
associate--r-83.2%
distribute-rgt-out--89.3%
*-commutative89.3%
distribute-lft-out--92.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 85.5%
+-commutative85.5%
associate--r+85.5%
Simplified85.5%
Taylor expanded in d1 around 0 82.1%
if -6.5e8 < d2 < 2.80000000000000024e-78Initial program 92.6%
associate--l+92.6%
distribute-lft-out--92.6%
*-commutative92.6%
Simplified92.6%
+-commutative92.6%
distribute-lft-out--93.6%
fma-def96.3%
Applied egg-rr96.3%
Taylor expanded in d1 around 0 82.3%
Taylor expanded in d2 around 0 81.8%
if 2.80000000000000024e-78 < d2 Initial program 83.9%
sub-neg83.9%
+-commutative83.9%
associate-+r+83.9%
+-commutative83.9%
sub-neg83.9%
+-commutative83.9%
associate-+r+83.9%
sub-neg83.9%
*-commutative83.9%
+-commutative83.9%
unsub-neg83.9%
associate--r-83.9%
distribute-rgt-out--90.1%
*-commutative90.1%
distribute-lft-out--91.3%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 72.0%
associate--r+72.0%
Simplified72.0%
Taylor expanded in d3 around 0 55.2%
Final simplification73.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 6e+16) (* d1 (- (- d2 d3) d1)) (* d1 (- (+ d2 d4) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 6e+16) {
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 <= 6d+16) 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 <= 6e+16) {
tmp = d1 * ((d2 - d3) - d1);
} else {
tmp = d1 * ((d2 + d4) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 6e+16: tmp = d1 * ((d2 - d3) - d1) else: tmp = d1 * ((d2 + d4) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 6e+16) 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 <= 6e+16) tmp = d1 * ((d2 - d3) - d1); else tmp = d1 * ((d2 + d4) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 6e+16], 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 6 \cdot 10^{+16}:\\
\;\;\;\;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 < 6e16Initial program 87.6%
sub-neg87.6%
+-commutative87.6%
associate-+r+87.6%
+-commutative87.6%
sub-neg87.6%
+-commutative87.6%
associate-+r+87.6%
sub-neg87.6%
*-commutative87.6%
+-commutative87.6%
unsub-neg87.6%
associate--r-87.6%
distribute-rgt-out--91.6%
*-commutative91.6%
distribute-lft-out--93.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.6%
+-commutative82.6%
associate--r+82.6%
Simplified82.6%
if 6e16 < d4 Initial program 86.9%
associate--l+86.9%
distribute-lft-out--88.8%
*-commutative88.8%
Simplified88.8%
+-commutative88.8%
distribute-lft-out--92.5%
fma-def94.4%
Applied egg-rr94.4%
Taylor expanded in d1 around 0 90.7%
Final simplification84.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -3.1e-56) (* d1 (- (+ d2 d4) d3)) (* d1 (- (- d4 d1) d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3.1e-56) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - d1) - 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 (d2 <= (-3.1d-56)) then
tmp = d1 * ((d2 + d4) - d3)
else
tmp = d1 * ((d4 - d1) - d3)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -3.1e-56) {
tmp = d1 * ((d2 + d4) - d3);
} else {
tmp = d1 * ((d4 - d1) - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -3.1e-56: tmp = d1 * ((d2 + d4) - d3) else: tmp = d1 * ((d4 - d1) - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -3.1e-56) tmp = Float64(d1 * Float64(Float64(d2 + d4) - d3)); else tmp = Float64(d1 * Float64(Float64(d4 - d1) - d3)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -3.1e-56) tmp = d1 * ((d2 + d4) - d3); else tmp = d1 * ((d4 - d1) - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -3.1e-56], N[(d1 * N[(N[(d2 + d4), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -3.1 \cdot 10^{-56}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d1\right) - d3\right)\\
\end{array}
\end{array}
if d2 < -3.09999999999999987e-56Initial program 85.4%
associate--l+85.4%
distribute-lft-out--85.4%
*-commutative85.4%
Simplified85.4%
+-commutative85.4%
distribute-lft-out--90.7%
fma-def96.0%
Applied egg-rr96.0%
Taylor expanded in d1 around 0 95.7%
if -3.09999999999999987e-56 < d2 Initial program 88.3%
sub-neg88.3%
+-commutative88.3%
associate-+r+88.3%
+-commutative88.3%
sub-neg88.3%
+-commutative88.3%
associate-+r+88.3%
sub-neg88.3%
*-commutative88.3%
+-commutative88.3%
unsub-neg88.3%
associate--r-88.3%
distribute-rgt-out--91.1%
*-commutative91.1%
distribute-lft-out--92.2%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 87.1%
associate--r+87.1%
Simplified87.1%
Final simplification89.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.1e+70) (* d1 (- d2 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.1e+70) {
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 <= 2.1d+70) 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 <= 2.1e+70) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.1e+70: tmp = d1 * (d2 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.1e+70) 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 <= 2.1e+70) tmp = d1 * (d2 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.1e+70], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.1 \cdot 10^{+70}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 2.10000000000000008e70Initial program 87.3%
sub-neg87.3%
+-commutative87.3%
associate-+r+87.3%
+-commutative87.3%
sub-neg87.3%
+-commutative87.3%
associate-+r+87.3%
sub-neg87.3%
*-commutative87.3%
+-commutative87.3%
unsub-neg87.3%
associate--r-87.3%
distribute-rgt-out--91.6%
*-commutative91.6%
distribute-lft-out--93.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 81.8%
+-commutative81.8%
associate--r+81.8%
Simplified81.8%
Taylor expanded in d3 around 0 60.1%
if 2.10000000000000008e70 < d4 Initial program 88.0%
associate--l+88.0%
distribute-lft-out--88.0%
*-commutative88.0%
Simplified88.0%
+-commutative88.0%
distribute-lft-out--92.8%
fma-def95.2%
Applied egg-rr95.2%
Taylor expanded in d1 around 0 92.9%
Taylor expanded in d3 around 0 80.3%
+-commutative80.3%
Simplified80.3%
Final simplification63.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 8.5e+63) (* d1 (- d2 d3)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.5e+63) {
tmp = d1 * (d2 - 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 <= 8.5d+63) then
tmp = d1 * (d2 - 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 <= 8.5e+63) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 8.5e+63: tmp = d1 * (d2 - d3) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 8.5e+63) tmp = Float64(d1 * Float64(d2 - 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 <= 8.5e+63) tmp = d1 * (d2 - d3); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 8.5e+63], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 8.5 \cdot 10^{+63}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 8.5000000000000004e63Initial program 87.7%
sub-neg87.7%
+-commutative87.7%
associate-+r+87.7%
+-commutative87.7%
sub-neg87.7%
+-commutative87.7%
associate-+r+87.7%
sub-neg87.7%
*-commutative87.7%
+-commutative87.7%
unsub-neg87.7%
associate--r-87.7%
distribute-rgt-out--91.5%
*-commutative91.5%
distribute-lft-out--93.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 82.0%
+-commutative82.0%
associate--r+82.0%
Simplified82.0%
Taylor expanded in d1 around 0 64.2%
if 8.5000000000000004e63 < d4 Initial program 86.3%
associate--l+86.3%
distribute-lft-out--86.3%
*-commutative86.3%
Simplified86.3%
+-commutative86.3%
distribute-lft-out--90.8%
fma-def93.1%
Applied egg-rr93.1%
Taylor expanded in d1 around 0 90.9%
Taylor expanded in d3 around 0 78.9%
+-commutative78.9%
Simplified78.9%
Final simplification66.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -2.7e-73) (* d1 (- d2 d3)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.7e-73) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d2 <= (-2.7d-73)) then
tmp = d1 * (d2 - d3)
else
tmp = d1 * (d4 - d1)
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -2.7e-73) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -2.7e-73: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -2.7e-73) tmp = Float64(d1 * Float64(d2 - d3)); else tmp = Float64(d1 * Float64(d4 - d1)); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -2.7e-73) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -2.7e-73], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -2.7 \cdot 10^{-73}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -2.69999999999999994e-73Initial program 86.0%
sub-neg86.0%
+-commutative86.0%
associate-+r+86.0%
+-commutative86.0%
sub-neg86.0%
+-commutative86.0%
associate-+r+86.0%
sub-neg86.0%
*-commutative86.0%
+-commutative86.0%
unsub-neg86.0%
associate--r-86.0%
distribute-rgt-out--91.1%
*-commutative91.1%
distribute-lft-out--93.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around 0 80.4%
+-commutative80.4%
associate--r+80.4%
Simplified80.4%
Taylor expanded in d1 around 0 76.5%
if -2.69999999999999994e-73 < d2 Initial program 88.1%
sub-neg88.1%
+-commutative88.1%
associate-+r+88.1%
+-commutative88.1%
sub-neg88.1%
+-commutative88.1%
associate-+r+88.1%
sub-neg88.1%
*-commutative88.1%
+-commutative88.1%
unsub-neg88.1%
associate--r-88.1%
distribute-rgt-out--90.9%
*-commutative90.9%
distribute-lft-out--92.1%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around 0 87.2%
associate--r+87.2%
Simplified87.2%
Taylor expanded in d3 around 0 63.7%
Final simplification67.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -105000000.0) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -105000000.0) {
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 <= (-105000000.0d0)) 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 <= -105000000.0) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -105000000.0: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -105000000.0) 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 <= -105000000.0) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -105000000.0], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -105000000:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -1.05e8Initial program 83.2%
sub-neg83.2%
+-commutative83.2%
associate-+r+83.2%
+-commutative83.2%
sub-neg83.2%
+-commutative83.2%
associate-+r+83.2%
sub-neg83.2%
*-commutative83.2%
+-commutative83.2%
unsub-neg83.2%
associate--r-83.2%
distribute-rgt-out--89.3%
*-commutative89.3%
distribute-lft-out--92.4%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 68.8%
if -1.05e8 < d2 Initial program 88.9%
sub-neg88.9%
+-commutative88.9%
associate-+r+88.9%
+-commutative88.9%
sub-neg88.9%
+-commutative88.9%
associate-+r+88.9%
sub-neg88.9%
*-commutative88.9%
+-commutative88.9%
unsub-neg88.9%
associate--r-88.9%
distribute-rgt-out--91.5%
*-commutative91.5%
distribute-lft-out--92.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d4 around inf 41.2%
Final simplification48.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 87.5%
sub-neg87.5%
+-commutative87.5%
associate-+r+87.5%
+-commutative87.5%
sub-neg87.5%
+-commutative87.5%
associate-+r+87.5%
sub-neg87.5%
*-commutative87.5%
+-commutative87.5%
unsub-neg87.5%
associate--r-87.5%
distribute-rgt-out--91.0%
*-commutative91.0%
distribute-lft-out--92.6%
distribute-lft-out--100.0%
Simplified100.0%
Taylor expanded in d2 around inf 34.1%
Final simplification34.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 2023320
(FPCore (d1 d2 d3 d4)
:name "FastMath dist4"
:precision binary64
:herbie-target
(* d1 (- (+ (- d2 d3) d4) d1))
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))