
(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 11 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 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
return d1 * (d2 + (d4 - (d1 + 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 + (d4 - (d1 + d3)))
end function
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (d2 + (d4 - (d1 + d3)));
}
def code(d1, d2, d3, d4): return d1 * (d2 + (d4 - (d1 + d3)))
function code(d1, d2, d3, d4) return Float64(d1 * Float64(d2 + Float64(d4 - Float64(d1 + d3)))) end
function tmp = code(d1, d2, d3, d4) tmp = d1 * (d2 + (d4 - (d1 + d3))); end
code[d1_, d2_, d3_, d4_] := N[(d1 * N[(d2 + N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
d1 \cdot \left(d2 + \left(d4 - \left(d1 + d3\right)\right)\right)
\end{array}
Initial program 85.5%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
(FPCore (d1 d2 d3 d4)
:precision binary64
(let* ((t_0 (- 0.0 (* d1 d3))))
(if (<= d3 -1e+214)
t_0
(if (<= d3 -1.5e-155) (* d1 d2) (if (<= d3 3.2e+76) (* d1 d4) t_0)))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = 0.0 - (d1 * d3);
double tmp;
if (d3 <= -1e+214) {
tmp = t_0;
} else if (d3 <= -1.5e-155) {
tmp = d1 * d2;
} else if (d3 <= 3.2e+76) {
tmp = d1 * d4;
} 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 = 0.0d0 - (d1 * d3)
if (d3 <= (-1d+214)) then
tmp = t_0
else if (d3 <= (-1.5d-155)) then
tmp = d1 * d2
else if (d3 <= 3.2d+76) then
tmp = d1 * d4
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 = 0.0 - (d1 * d3);
double tmp;
if (d3 <= -1e+214) {
tmp = t_0;
} else if (d3 <= -1.5e-155) {
tmp = d1 * d2;
} else if (d3 <= 3.2e+76) {
tmp = d1 * d4;
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = 0.0 - (d1 * d3) tmp = 0 if d3 <= -1e+214: tmp = t_0 elif d3 <= -1.5e-155: tmp = d1 * d2 elif d3 <= 3.2e+76: tmp = d1 * d4 else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(0.0 - Float64(d1 * d3)) tmp = 0.0 if (d3 <= -1e+214) tmp = t_0; elseif (d3 <= -1.5e-155) tmp = Float64(d1 * d2); elseif (d3 <= 3.2e+76) tmp = Float64(d1 * d4); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = 0.0 - (d1 * d3); tmp = 0.0; if (d3 <= -1e+214) tmp = t_0; elseif (d3 <= -1.5e-155) tmp = d1 * d2; elseif (d3 <= 3.2e+76) tmp = d1 * d4; else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(0.0 - N[(d1 * d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1e+214], t$95$0, If[LessEqual[d3, -1.5e-155], N[(d1 * d2), $MachinePrecision], If[LessEqual[d3, 3.2e+76], N[(d1 * d4), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0 - d1 \cdot d3\\
\mathbf{if}\;d3 \leq -1 \cdot 10^{+214}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq -1.5 \cdot 10^{-155}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d3 \leq 3.2 \cdot 10^{+76}:\\
\;\;\;\;d1 \cdot d4\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -9.9999999999999995e213 or 3.19999999999999976e76 < d3 Initial program 79.5%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d3 around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6477.6%
Simplified77.6%
sub0-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f6477.6%
Applied egg-rr77.6%
if -9.9999999999999995e213 < d3 < -1.49999999999999992e-155Initial program 87.2%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d2 around inf
*-lowering-*.f6438.3%
Simplified38.3%
if -1.49999999999999992e-155 < d3 < 3.19999999999999976e76Initial program 88.5%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around inf
*-lowering-*.f6442.8%
Simplified42.8%
Final simplification51.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -340000000.0) (* d1 (- d2 d3)) (if (<= d2 6.4e-130) (* d1 (- d4 d1)) (* d1 (- d4 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -340000000.0) {
tmp = d1 * (d2 - d3);
} else if (d2 <= 6.4e-130) {
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 (d2 <= (-340000000.0d0)) then
tmp = d1 * (d2 - d3)
else if (d2 <= 6.4d-130) 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 (d2 <= -340000000.0) {
tmp = d1 * (d2 - d3);
} else if (d2 <= 6.4e-130) {
tmp = d1 * (d4 - d1);
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -340000000.0: tmp = d1 * (d2 - d3) elif d2 <= 6.4e-130: tmp = d1 * (d4 - d1) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -340000000.0) tmp = Float64(d1 * Float64(d2 - d3)); elseif (d2 <= 6.4e-130) 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 (d2 <= -340000000.0) tmp = d1 * (d2 - d3); elseif (d2 <= 6.4e-130) tmp = d1 * (d4 - d1); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -340000000.0], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], If[LessEqual[d2, 6.4e-130], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -340000000:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq 6.4 \cdot 10^{-130}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d2 < -3.4e8Initial program 80.4%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6486.7%
Simplified86.7%
Taylor expanded in d1 around 0
remove-double-negN/A
distribute-rgt-neg-outN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
sub-negN/A
distribute-lft-inN/A
mul-1-negN/A
remove-double-negN/A
Simplified71.0%
if -3.4e8 < d2 < 6.3999999999999999e-130Initial program 88.0%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d2 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6498.0%
Simplified98.0%
Taylor expanded in d3 around 0
*-lowering-*.f64N/A
--lowering--.f6475.7%
Simplified75.7%
if 6.3999999999999999e-130 < d2 Initial program 85.8%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d2 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6471.5%
Simplified71.5%
Taylor expanded in d1 around 0
*-lowering-*.f64N/A
--lowering--.f6453.8%
Simplified53.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (let* ((t_0 (* d1 (- d2 d3)))) (if (<= d3 -4.7e+55) t_0 (if (<= d3 7e+77) (* d1 (+ d2 d4)) t_0))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = d1 * (d2 - d3);
double tmp;
if (d3 <= -4.7e+55) {
tmp = t_0;
} else if (d3 <= 7e+77) {
tmp = d1 * (d2 + d4);
} 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 * (d2 - d3)
if (d3 <= (-4.7d+55)) then
tmp = t_0
else if (d3 <= 7d+77) then
tmp = d1 * (d2 + d4)
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 - d3);
double tmp;
if (d3 <= -4.7e+55) {
tmp = t_0;
} else if (d3 <= 7e+77) {
tmp = d1 * (d2 + d4);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = d1 * (d2 - d3) tmp = 0 if d3 <= -4.7e+55: tmp = t_0 elif d3 <= 7e+77: tmp = d1 * (d2 + d4) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(d1 * Float64(d2 - d3)) tmp = 0.0 if (d3 <= -4.7e+55) tmp = t_0; elseif (d3 <= 7e+77) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = d1 * (d2 - d3); tmp = 0.0; if (d3 <= -4.7e+55) tmp = t_0; elseif (d3 <= 7e+77) tmp = d1 * (d2 + d4); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -4.7e+55], t$95$0, If[LessEqual[d3, 7e+77], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d3 \leq -4.7 \cdot 10^{+55}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 7 \cdot 10^{+77}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -4.7000000000000001e55 or 7.0000000000000003e77 < d3 Initial program 81.0%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6489.5%
Simplified89.5%
Taylor expanded in d1 around 0
remove-double-negN/A
distribute-rgt-neg-outN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
sub-negN/A
distribute-lft-inN/A
mul-1-negN/A
remove-double-negN/A
Simplified78.5%
if -4.7000000000000001e55 < d3 < 7.0000000000000003e77Initial program 88.4%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around inf
Simplified70.6%
(FPCore (d1 d2 d3 d4) :precision binary64 (let* ((t_0 (- 0.0 (* d1 d3)))) (if (<= d3 -1e+214) t_0 (if (<= d3 3.9e+90) (* d1 (+ d2 d4)) t_0))))
double code(double d1, double d2, double d3, double d4) {
double t_0 = 0.0 - (d1 * d3);
double tmp;
if (d3 <= -1e+214) {
tmp = t_0;
} else if (d3 <= 3.9e+90) {
tmp = d1 * (d2 + d4);
} 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 = 0.0d0 - (d1 * d3)
if (d3 <= (-1d+214)) then
tmp = t_0
else if (d3 <= 3.9d+90) then
tmp = d1 * (d2 + d4)
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 = 0.0 - (d1 * d3);
double tmp;
if (d3 <= -1e+214) {
tmp = t_0;
} else if (d3 <= 3.9e+90) {
tmp = d1 * (d2 + d4);
} else {
tmp = t_0;
}
return tmp;
}
def code(d1, d2, d3, d4): t_0 = 0.0 - (d1 * d3) tmp = 0 if d3 <= -1e+214: tmp = t_0 elif d3 <= 3.9e+90: tmp = d1 * (d2 + d4) else: tmp = t_0 return tmp
function code(d1, d2, d3, d4) t_0 = Float64(0.0 - Float64(d1 * d3)) tmp = 0.0 if (d3 <= -1e+214) tmp = t_0; elseif (d3 <= 3.9e+90) tmp = Float64(d1 * Float64(d2 + d4)); else tmp = t_0; end return tmp end
function tmp_2 = code(d1, d2, d3, d4) t_0 = 0.0 - (d1 * d3); tmp = 0.0; if (d3 <= -1e+214) tmp = t_0; elseif (d3 <= 3.9e+90) tmp = d1 * (d2 + d4); else tmp = t_0; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := Block[{t$95$0 = N[(0.0 - N[(d1 * d3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d3, -1e+214], t$95$0, If[LessEqual[d3, 3.9e+90], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0 - d1 \cdot d3\\
\mathbf{if}\;d3 \leq -1 \cdot 10^{+214}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;d3 \leq 3.9 \cdot 10^{+90}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if d3 < -9.9999999999999995e213 or 3.9000000000000002e90 < d3 Initial program 78.9%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d3 around inf
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6479.5%
Simplified79.5%
sub0-negN/A
neg-lowering-neg.f64N/A
*-lowering-*.f6479.5%
Applied egg-rr79.5%
if -9.9999999999999995e213 < d3 < 3.9000000000000002e90Initial program 88.1%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around inf
Simplified69.3%
Final simplification72.1%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -6500000.0) (* d1 (- d2 (+ d1 d3))) (* d1 (- d4 (+ d1 d3)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -6500000.0) {
tmp = d1 * (d2 - (d1 + 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 <= (-6500000.0d0)) then
tmp = d1 * (d2 - (d1 + 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 <= -6500000.0) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * (d4 - (d1 + d3));
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -6500000.0: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * (d4 - (d1 + d3)) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -6500000.0) tmp = Float64(d1 * Float64(d2 - Float64(d1 + d3))); else tmp = Float64(d1 * Float64(d4 - Float64(d1 + d3))); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d2 <= -6500000.0) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * (d4 - (d1 + d3)); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -6500000.0], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -6500000:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\end{array}
if d2 < -6.5e6Initial program 81.1%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6485.3%
Simplified85.3%
if -6.5e6 < d2 Initial program 86.7%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d2 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6483.7%
Simplified83.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 7.2e+132) (* d1 (- d2 (+ d1 d3))) (* d1 (- d4 d3))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 7.2e+132) {
tmp = d1 * (d2 - (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 <= 7.2d+132) then
tmp = d1 * (d2 - (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 <= 7.2e+132) {
tmp = d1 * (d2 - (d1 + d3));
} else {
tmp = d1 * (d4 - d3);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 7.2e+132: tmp = d1 * (d2 - (d1 + d3)) else: tmp = d1 * (d4 - d3) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 7.2e+132) tmp = Float64(d1 * Float64(d2 - 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 <= 7.2e+132) tmp = d1 * (d2 - (d1 + d3)); else tmp = d1 * (d4 - d3); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 7.2e+132], N[(d1 * N[(d2 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 7.2 \cdot 10^{+132}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\end{array}
if d4 < 7.20000000000000031e132Initial program 85.2%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6484.3%
Simplified84.3%
if 7.20000000000000031e132 < d4 Initial program 87.2%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d2 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6495.0%
Simplified95.0%
Taylor expanded in d1 around 0
*-lowering-*.f64N/A
--lowering--.f6492.5%
Simplified92.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -1300000000.0) (* d1 (- d2 d3)) (* d1 (- d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -1300000000.0) {
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 <= (-1300000000.0d0)) 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 <= -1300000000.0) {
tmp = d1 * (d2 - d3);
} else {
tmp = d1 * (d4 - d1);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -1300000000.0: tmp = d1 * (d2 - d3) else: tmp = d1 * (d4 - d1) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -1300000000.0) 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 <= -1300000000.0) tmp = d1 * (d2 - d3); else tmp = d1 * (d4 - d1); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -1300000000.0], N[(d1 * N[(d2 - d3), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -1300000000:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\end{array}
if d2 < -1.3e9Initial program 80.4%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6486.7%
Simplified86.7%
Taylor expanded in d1 around 0
remove-double-negN/A
distribute-rgt-neg-outN/A
mul-1-negN/A
distribute-rgt-neg-inN/A
*-rgt-identityN/A
*-inversesN/A
associate-/l*N/A
associate-*l/N/A
associate-*r/N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
associate-*r/N/A
associate-*l/N/A
associate-/l*N/A
*-inversesN/A
*-rgt-identityN/A
sub-negN/A
distribute-lft-inN/A
mul-1-negN/A
remove-double-negN/A
Simplified71.0%
if -1.3e9 < d2 Initial program 86.8%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d2 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6483.4%
Simplified83.4%
Taylor expanded in d3 around 0
*-lowering-*.f64N/A
--lowering--.f6461.9%
Simplified61.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.02e+62) (* d1 (- d2 d1)) (* d1 (+ d2 d4))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.02e+62) {
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 <= 1.02d+62) 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 <= 1.02e+62) {
tmp = d1 * (d2 - d1);
} else {
tmp = d1 * (d2 + d4);
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.02e+62: tmp = d1 * (d2 - d1) else: tmp = d1 * (d2 + d4) return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.02e+62) 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 <= 1.02e+62) tmp = d1 * (d2 - d1); else tmp = d1 * (d2 + d4); end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.02e+62], N[(d1 * N[(d2 - d1), $MachinePrecision]), $MachinePrecision], N[(d1 * N[(d2 + d4), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.02 \cdot 10^{+62}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\end{array}
if d4 < 1.02000000000000002e62Initial program 86.2%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around 0
*-lowering-*.f64N/A
--lowering--.f64N/A
+-lowering-+.f6484.2%
Simplified84.2%
Taylor expanded in d3 around 0
*-lowering-*.f64N/A
--lowering--.f6460.9%
Simplified60.9%
if 1.02000000000000002e62 < d4 Initial program 83.0%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around inf
Simplified76.3%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d2 -0.00136) (* d1 d2) (* d1 d4)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d2 <= -0.00136) {
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 <= (-0.00136d0)) 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 <= -0.00136) {
tmp = d1 * d2;
} else {
tmp = d1 * d4;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d2 <= -0.00136: tmp = d1 * d2 else: tmp = d1 * d4 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d2 <= -0.00136) 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 <= -0.00136) tmp = d1 * d2; else tmp = d1 * d4; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d2, -0.00136], N[(d1 * d2), $MachinePrecision], N[(d1 * d4), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d2 \leq -0.00136:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\end{array}
if d2 < -0.00136Initial program 81.5%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d2 around inf
*-lowering-*.f6453.1%
Simplified53.1%
if -0.00136 < d2 Initial program 86.6%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d4 around inf
*-lowering-*.f6434.8%
Simplified34.8%
(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 85.5%
distribute-lft-out--N/A
*-commutativeN/A
distribute-lft-outN/A
distribute-lft-out--N/A
*-lowering-*.f64N/A
associate-+r-N/A
sub-negN/A
associate-+l+N/A
+-lowering-+.f64N/A
associate-+r-N/A
+-commutativeN/A
unsub-negN/A
associate--l-N/A
--lowering--.f64N/A
+-commutativeN/A
+-lowering-+.f64100.0%
Simplified100.0%
Taylor expanded in d2 around inf
*-lowering-*.f6431.5%
Simplified31.5%
(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 2024144
(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)))