
(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 13 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 (if (<= (- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)) INFINITY) (fma d2 d1 (fma (- d3) d1 (* d1 (- d4 d1)))) (* (- (- d2 d3) d1) d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (((((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)) <= ((double) INFINITY)) {
tmp = fma(d2, d1, fma(-d3, d1, (d1 * (d4 - d1))));
} else {
tmp = ((d2 - d3) - d1) * d1;
}
return tmp;
}
function code(d1, d2, d3, d4) tmp = 0.0 if (Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1)) <= Inf) tmp = fma(d2, d1, fma(Float64(-d3), d1, Float64(d1 * Float64(d4 - d1)))); else tmp = Float64(Float64(Float64(d2 - d3) - d1) * d1); end return tmp end
code[d1_, d2_, d3_, d4_] := If[LessEqual[N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision], Infinity], N[(d2 * d1 + N[((-d3) * d1 + N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision] * d1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1 \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(d2, d1, \mathsf{fma}\left(-d3, d1, d1 \cdot \left(d4 - d1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(d2 - d3\right) - d1\right) \cdot d1\\
\end{array}
\end{array}
if (-.f64 (+.f64 (-.f64 (*.f64 d1 d2) (*.f64 d1 d3)) (*.f64 d4 d1)) (*.f64 d1 d1)) < +inf.0Initial program 100.0%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f64100.0
Applied rewrites100.0%
if +inf.0 < (-.f64 (+.f64 (-.f64 (*.f64 d1 d2) (*.f64 d1 d3)) (*.f64 d4 d1)) (*.f64 d1 d1)) Initial program 0.0%
Taylor expanded in d4 around 0
associate--r+N/A
distribute-lft-out--N/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6491.4
Applied rewrites91.4%
Final simplification98.8%
(FPCore (d1 d2 d3 d4)
:precision binary64
(if (<= d4 9.2e-40)
(* (- d2 d3) d1)
(if (<= d4 8e+29)
(* (- d2 d1) d1)
(if (<= d4 4.2e+139) (* (- d4 d3) d1) (* (+ d2 d4) d1)))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 9.2e-40) {
tmp = (d2 - d3) * d1;
} else if (d4 <= 8e+29) {
tmp = (d2 - d1) * d1;
} else if (d4 <= 4.2e+139) {
tmp = (d4 - d3) * d1;
} else {
tmp = (d2 + d4) * d1;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 9.2d-40) then
tmp = (d2 - d3) * d1
else if (d4 <= 8d+29) then
tmp = (d2 - d1) * d1
else if (d4 <= 4.2d+139) then
tmp = (d4 - d3) * d1
else
tmp = (d2 + d4) * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 9.2e-40) {
tmp = (d2 - d3) * d1;
} else if (d4 <= 8e+29) {
tmp = (d2 - d1) * d1;
} else if (d4 <= 4.2e+139) {
tmp = (d4 - d3) * d1;
} else {
tmp = (d2 + d4) * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 9.2e-40: tmp = (d2 - d3) * d1 elif d4 <= 8e+29: tmp = (d2 - d1) * d1 elif d4 <= 4.2e+139: tmp = (d4 - d3) * d1 else: tmp = (d2 + d4) * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 9.2e-40) tmp = Float64(Float64(d2 - d3) * d1); elseif (d4 <= 8e+29) tmp = Float64(Float64(d2 - d1) * d1); elseif (d4 <= 4.2e+139) tmp = Float64(Float64(d4 - d3) * d1); else tmp = Float64(Float64(d2 + d4) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 9.2e-40) tmp = (d2 - d3) * d1; elseif (d4 <= 8e+29) tmp = (d2 - d1) * d1; elseif (d4 <= 4.2e+139) tmp = (d4 - d3) * d1; else tmp = (d2 + d4) * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 9.2e-40], N[(N[(d2 - d3), $MachinePrecision] * d1), $MachinePrecision], If[LessEqual[d4, 8e+29], N[(N[(d2 - d1), $MachinePrecision] * d1), $MachinePrecision], If[LessEqual[d4, 4.2e+139], N[(N[(d4 - d3), $MachinePrecision] * d1), $MachinePrecision], N[(N[(d2 + d4), $MachinePrecision] * d1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 9.2 \cdot 10^{-40}:\\
\;\;\;\;\left(d2 - d3\right) \cdot d1\\
\mathbf{elif}\;d4 \leq 8 \cdot 10^{+29}:\\
\;\;\;\;\left(d2 - d1\right) \cdot d1\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{+139}:\\
\;\;\;\;\left(d4 - d3\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;\left(d2 + d4\right) \cdot d1\\
\end{array}
\end{array}
if d4 < 9.2e-40Initial program 88.3%
Taylor expanded in d1 around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6484.9
Applied rewrites84.9%
Taylor expanded in d4 around 0
Applied rewrites65.7%
if 9.2e-40 < d4 < 7.99999999999999931e29Initial program 100.0%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6481.4
Applied rewrites81.4%
Taylor expanded in d4 around 0
Applied rewrites81.4%
if 7.99999999999999931e29 < d4 < 4.1999999999999997e139Initial program 76.7%
Taylor expanded in d1 around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6480.5
Applied rewrites80.5%
Taylor expanded in d2 around 0
Applied rewrites58.3%
if 4.1999999999999997e139 < d4 Initial program 78.6%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in d1 around 0
Applied rewrites89.3%
Final simplification68.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -3.6e+65) (not (<= d3 6e+103))) (* (- (+ d4 d2) d3) d1) (* (- (+ d4 d2) d1) d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.6e+65) || !(d3 <= 6e+103)) {
tmp = ((d4 + d2) - d3) * d1;
} else {
tmp = ((d4 + d2) - 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 ((d3 <= (-3.6d+65)) .or. (.not. (d3 <= 6d+103))) then
tmp = ((d4 + d2) - d3) * d1
else
tmp = ((d4 + d2) - d1) * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -3.6e+65) || !(d3 <= 6e+103)) {
tmp = ((d4 + d2) - d3) * d1;
} else {
tmp = ((d4 + d2) - d1) * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -3.6e+65) or not (d3 <= 6e+103): tmp = ((d4 + d2) - d3) * d1 else: tmp = ((d4 + d2) - d1) * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -3.6e+65) || !(d3 <= 6e+103)) tmp = Float64(Float64(Float64(d4 + d2) - d3) * d1); else tmp = Float64(Float64(Float64(d4 + d2) - d1) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -3.6e+65) || ~((d3 <= 6e+103))) tmp = ((d4 + d2) - d3) * d1; else tmp = ((d4 + d2) - d1) * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -3.6e+65], N[Not[LessEqual[d3, 6e+103]], $MachinePrecision]], N[(N[(N[(d4 + d2), $MachinePrecision] - d3), $MachinePrecision] * d1), $MachinePrecision], N[(N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision] * d1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -3.6 \cdot 10^{+65} \lor \neg \left(d3 \leq 6 \cdot 10^{+103}\right):\\
\;\;\;\;\left(\left(d4 + d2\right) - d3\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(d4 + d2\right) - d1\right) \cdot d1\\
\end{array}
\end{array}
if d3 < -3.59999999999999978e65 or 6e103 < d3 Initial program 82.8%
Taylor expanded in d1 around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6496.8
Applied rewrites96.8%
if -3.59999999999999978e65 < d3 < 6e103Initial program 88.3%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6495.4
Applied rewrites95.4%
Final simplification95.9%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.02e+129) (not (<= d3 4.8e+120))) (* (- d2 d3) d1) (* (- (+ d4 d2) d1) d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.02e+129) || !(d3 <= 4.8e+120)) {
tmp = (d2 - d3) * d1;
} else {
tmp = ((d4 + d2) - 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 ((d3 <= (-1.02d+129)) .or. (.not. (d3 <= 4.8d+120))) then
tmp = (d2 - d3) * d1
else
tmp = ((d4 + d2) - d1) * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.02e+129) || !(d3 <= 4.8e+120)) {
tmp = (d2 - d3) * d1;
} else {
tmp = ((d4 + d2) - d1) * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.02e+129) or not (d3 <= 4.8e+120): tmp = (d2 - d3) * d1 else: tmp = ((d4 + d2) - d1) * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.02e+129) || !(d3 <= 4.8e+120)) tmp = Float64(Float64(d2 - d3) * d1); else tmp = Float64(Float64(Float64(d4 + d2) - d1) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.02e+129) || ~((d3 <= 4.8e+120))) tmp = (d2 - d3) * d1; else tmp = ((d4 + d2) - d1) * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.02e+129], N[Not[LessEqual[d3, 4.8e+120]], $MachinePrecision]], N[(N[(d2 - d3), $MachinePrecision] * d1), $MachinePrecision], N[(N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision] * d1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.02 \cdot 10^{+129} \lor \neg \left(d3 \leq 4.8 \cdot 10^{+120}\right):\\
\;\;\;\;\left(d2 - d3\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(d4 + d2\right) - d1\right) \cdot d1\\
\end{array}
\end{array}
if d3 < -1.01999999999999996e129 or 4.80000000000000002e120 < d3 Initial program 84.9%
Taylor expanded in d1 around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6498.6
Applied rewrites98.6%
Taylor expanded in d4 around 0
Applied rewrites90.2%
if -1.01999999999999996e129 < d3 < 4.80000000000000002e120Initial program 86.9%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6493.3
Applied rewrites93.3%
Final simplification92.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 2.8e+46) (* (- (- d2 d3) d1) d1) (if (<= d4 4.2e+139) (* (- (- d4 d1) d3) d1) (* (- (+ d4 d2) d1) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.8e+46) {
tmp = ((d2 - d3) - d1) * d1;
} else if (d4 <= 4.2e+139) {
tmp = ((d4 - d1) - d3) * d1;
} else {
tmp = ((d4 + d2) - 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 (d4 <= 2.8d+46) then
tmp = ((d2 - d3) - d1) * d1
else if (d4 <= 4.2d+139) then
tmp = ((d4 - d1) - d3) * d1
else
tmp = ((d4 + d2) - d1) * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 2.8e+46) {
tmp = ((d2 - d3) - d1) * d1;
} else if (d4 <= 4.2e+139) {
tmp = ((d4 - d1) - d3) * d1;
} else {
tmp = ((d4 + d2) - d1) * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 2.8e+46: tmp = ((d2 - d3) - d1) * d1 elif d4 <= 4.2e+139: tmp = ((d4 - d1) - d3) * d1 else: tmp = ((d4 + d2) - d1) * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 2.8e+46) tmp = Float64(Float64(Float64(d2 - d3) - d1) * d1); elseif (d4 <= 4.2e+139) tmp = Float64(Float64(Float64(d4 - d1) - d3) * d1); else tmp = Float64(Float64(Float64(d4 + d2) - d1) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 2.8e+46) tmp = ((d2 - d3) - d1) * d1; elseif (d4 <= 4.2e+139) tmp = ((d4 - d1) - d3) * d1; else tmp = ((d4 + d2) - d1) * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 2.8e+46], N[(N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision] * d1), $MachinePrecision], If[LessEqual[d4, 4.2e+139], N[(N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision] * d1), $MachinePrecision], N[(N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision] * d1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 2.8 \cdot 10^{+46}:\\
\;\;\;\;\left(\left(d2 - d3\right) - d1\right) \cdot d1\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{+139}:\\
\;\;\;\;\left(\left(d4 - d1\right) - d3\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(d4 + d2\right) - d1\right) \cdot d1\\
\end{array}
\end{array}
if d4 < 2.80000000000000018e46Initial program 88.8%
Taylor expanded in d4 around 0
associate--r+N/A
distribute-lft-out--N/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6483.7
Applied rewrites83.7%
if 2.80000000000000018e46 < d4 < 4.1999999999999997e139Initial program 73.9%
Taylor expanded in d4 around inf
*-commutativeN/A
lower-*.f6436.5
Applied rewrites36.5%
Taylor expanded in d2 around 0
+-commutativeN/A
unpow2N/A
distribute-lft-outN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-outN/A
distribute-lft-inN/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower--.f6483.4
Applied rewrites83.4%
if 4.1999999999999997e139 < d4 Initial program 78.6%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Final simplification85.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.38e-245) (* (- d2 d3) d1) (if (<= d4 3.3e+80) (* (- (- d1) d3) d1) (* (- d4 d1) d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.38e-245) {
tmp = (d2 - d3) * d1;
} else if (d4 <= 3.3e+80) {
tmp = (-d1 - d3) * d1;
} else {
tmp = (d4 - 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 (d4 <= 1.38d-245) then
tmp = (d2 - d3) * d1
else if (d4 <= 3.3d+80) then
tmp = (-d1 - d3) * d1
else
tmp = (d4 - d1) * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.38e-245) {
tmp = (d2 - d3) * d1;
} else if (d4 <= 3.3e+80) {
tmp = (-d1 - d3) * d1;
} else {
tmp = (d4 - d1) * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.38e-245: tmp = (d2 - d3) * d1 elif d4 <= 3.3e+80: tmp = (-d1 - d3) * d1 else: tmp = (d4 - d1) * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.38e-245) tmp = Float64(Float64(d2 - d3) * d1); elseif (d4 <= 3.3e+80) tmp = Float64(Float64(Float64(-d1) - d3) * d1); else tmp = Float64(Float64(d4 - d1) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.38e-245) tmp = (d2 - d3) * d1; elseif (d4 <= 3.3e+80) tmp = (-d1 - d3) * d1; else tmp = (d4 - d1) * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.38e-245], N[(N[(d2 - d3), $MachinePrecision] * d1), $MachinePrecision], If[LessEqual[d4, 3.3e+80], N[(N[((-d1) - d3), $MachinePrecision] * d1), $MachinePrecision], N[(N[(d4 - d1), $MachinePrecision] * d1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.38 \cdot 10^{-245}:\\
\;\;\;\;\left(d2 - d3\right) \cdot d1\\
\mathbf{elif}\;d4 \leq 3.3 \cdot 10^{+80}:\\
\;\;\;\;\left(\left(-d1\right) - d3\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;\left(d4 - d1\right) \cdot d1\\
\end{array}
\end{array}
if d4 < 1.38000000000000006e-245Initial program 87.3%
Taylor expanded in d1 around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6491.1
Applied rewrites91.1%
Taylor expanded in d4 around 0
Applied rewrites65.6%
if 1.38000000000000006e-245 < d4 < 3.29999999999999991e80Initial program 90.4%
Taylor expanded in d4 around inf
*-commutativeN/A
lower-*.f6410.2
Applied rewrites10.2%
Taylor expanded in d2 around 0
+-commutativeN/A
unpow2N/A
distribute-lft-outN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-outN/A
distribute-lft-inN/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower--.f6473.8
Applied rewrites73.8%
Taylor expanded in d4 around 0
Applied rewrites72.4%
if 3.29999999999999991e80 < d4 Initial program 75.6%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6495.1
Applied rewrites95.1%
Taylor expanded in d2 around 0
Applied rewrites78.1%
Final simplification69.5%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (or (<= d3 -1.6e+238) (not (<= d3 3.8e+124))) (* (- d3) d1) (* (+ d2 d4) d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if ((d3 <= -1.6e+238) || !(d3 <= 3.8e+124)) {
tmp = -d3 * d1;
} else {
tmp = (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.6d+238)) .or. (.not. (d3 <= 3.8d+124))) then
tmp = -d3 * d1
else
tmp = (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.6e+238) || !(d3 <= 3.8e+124)) {
tmp = -d3 * d1;
} else {
tmp = (d2 + d4) * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if (d3 <= -1.6e+238) or not (d3 <= 3.8e+124): tmp = -d3 * d1 else: tmp = (d2 + d4) * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if ((d3 <= -1.6e+238) || !(d3 <= 3.8e+124)) tmp = Float64(Float64(-d3) * d1); else tmp = Float64(Float64(d2 + d4) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if ((d3 <= -1.6e+238) || ~((d3 <= 3.8e+124))) tmp = -d3 * d1; else tmp = (d2 + d4) * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[Or[LessEqual[d3, -1.6e+238], N[Not[LessEqual[d3, 3.8e+124]], $MachinePrecision]], N[((-d3) * d1), $MachinePrecision], N[(N[(d2 + d4), $MachinePrecision] * d1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d3 \leq -1.6 \cdot 10^{+238} \lor \neg \left(d3 \leq 3.8 \cdot 10^{+124}\right):\\
\;\;\;\;\left(-d3\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;\left(d2 + d4\right) \cdot d1\\
\end{array}
\end{array}
if d3 < -1.5999999999999999e238 or 3.7999999999999998e124 < d3 Initial program 81.8%
Taylor expanded in d4 around inf
*-commutativeN/A
lower-*.f6414.7
Applied rewrites14.7%
Taylor expanded in d2 around 0
+-commutativeN/A
unpow2N/A
distribute-lft-outN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-outN/A
distribute-lft-inN/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower--.f6489.7
Applied rewrites89.7%
Taylor expanded in d4 around 0
Applied rewrites83.3%
Taylor expanded in d1 around 0
Applied rewrites81.5%
if -1.5999999999999999e238 < d3 < 3.7999999999999998e124Initial program 87.5%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6490.5
Applied rewrites90.5%
Taylor expanded in d1 around 0
Applied rewrites71.1%
Final simplification73.4%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.3e-216) (* d2 d1) (if (<= d4 1.05e+71) (* (- d3) d1) (* d4 d1))))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.3e-216) {
tmp = d2 * d1;
} else if (d4 <= 1.05e+71) {
tmp = -d3 * d1;
} else {
tmp = d4 * d1;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 1.3d-216) then
tmp = d2 * d1
else if (d4 <= 1.05d+71) then
tmp = -d3 * d1
else
tmp = d4 * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.3e-216) {
tmp = d2 * d1;
} else if (d4 <= 1.05e+71) {
tmp = -d3 * d1;
} else {
tmp = d4 * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.3e-216: tmp = d2 * d1 elif d4 <= 1.05e+71: tmp = -d3 * d1 else: tmp = d4 * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.3e-216) tmp = Float64(d2 * d1); elseif (d4 <= 1.05e+71) tmp = Float64(Float64(-d3) * d1); else tmp = Float64(d4 * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.3e-216) tmp = d2 * d1; elseif (d4 <= 1.05e+71) tmp = -d3 * d1; else tmp = d4 * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.3e-216], N[(d2 * d1), $MachinePrecision], If[LessEqual[d4, 1.05e+71], N[((-d3) * d1), $MachinePrecision], N[(d4 * d1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.3 \cdot 10^{-216}:\\
\;\;\;\;d2 \cdot d1\\
\mathbf{elif}\;d4 \leq 1.05 \cdot 10^{+71}:\\
\;\;\;\;\left(-d3\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d4 \cdot d1\\
\end{array}
\end{array}
if d4 < 1.2999999999999999e-216Initial program 87.0%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6496.6
Applied rewrites96.6%
Taylor expanded in d2 around inf
*-commutativeN/A
lower-*.f6441.5
Applied rewrites41.5%
if 1.2999999999999999e-216 < d4 < 1.04999999999999995e71Initial program 91.3%
Taylor expanded in d4 around inf
*-commutativeN/A
lower-*.f6410.6
Applied rewrites10.6%
Taylor expanded in d2 around 0
+-commutativeN/A
unpow2N/A
distribute-lft-outN/A
fp-cancel-sub-sign-invN/A
mul-1-negN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-outN/A
distribute-lft-inN/A
*-commutativeN/A
lower-*.f64N/A
associate-+r+N/A
fp-cancel-sign-sub-invN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower--.f6473.7
Applied rewrites73.7%
Taylor expanded in d4 around 0
Applied rewrites72.2%
Taylor expanded in d1 around 0
Applied rewrites42.5%
if 1.04999999999999995e71 < d4 Initial program 75.6%
Taylor expanded in d4 around inf
*-commutativeN/A
lower-*.f6461.5
Applied rewrites61.5%
Final simplification45.0%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 3.3e+80) (* (- (- d2 d3) d1) d1) (* (- (+ d4 d2) d1) d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.3e+80) {
tmp = ((d2 - d3) - d1) * d1;
} else {
tmp = ((d4 + d2) - 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 (d4 <= 3.3d+80) then
tmp = ((d2 - d3) - d1) * d1
else
tmp = ((d4 + d2) - d1) * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 3.3e+80) {
tmp = ((d2 - d3) - d1) * d1;
} else {
tmp = ((d4 + d2) - d1) * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 3.3e+80: tmp = ((d2 - d3) - d1) * d1 else: tmp = ((d4 + d2) - d1) * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 3.3e+80) tmp = Float64(Float64(Float64(d2 - d3) - d1) * d1); else tmp = Float64(Float64(Float64(d4 + d2) - d1) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 3.3e+80) tmp = ((d2 - d3) - d1) * d1; else tmp = ((d4 + d2) - d1) * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 3.3e+80], N[(N[(N[(d2 - d3), $MachinePrecision] - d1), $MachinePrecision] * d1), $MachinePrecision], N[(N[(N[(d4 + d2), $MachinePrecision] - d1), $MachinePrecision] * d1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 3.3 \cdot 10^{+80}:\\
\;\;\;\;\left(\left(d2 - d3\right) - d1\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;\left(\left(d4 + d2\right) - d1\right) \cdot d1\\
\end{array}
\end{array}
if d4 < 3.29999999999999991e80Initial program 88.4%
Taylor expanded in d4 around 0
associate--r+N/A
distribute-lft-out--N/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6484.0
Applied rewrites84.0%
if 3.29999999999999991e80 < d4 Initial program 75.6%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6495.1
Applied rewrites95.1%
Final simplification85.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 8.6e+70) (* (- d2 d3) d1) (* (- d4 d1) d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.6e+70) {
tmp = (d2 - d3) * d1;
} else {
tmp = (d4 - 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 (d4 <= 8.6d+70) then
tmp = (d2 - d3) * d1
else
tmp = (d4 - d1) * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8.6e+70) {
tmp = (d2 - d3) * d1;
} else {
tmp = (d4 - d1) * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 8.6e+70: tmp = (d2 - d3) * d1 else: tmp = (d4 - d1) * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 8.6e+70) tmp = Float64(Float64(d2 - d3) * d1); else tmp = Float64(Float64(d4 - d1) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 8.6e+70) tmp = (d2 - d3) * d1; else tmp = (d4 - d1) * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 8.6e+70], N[(N[(d2 - d3), $MachinePrecision] * d1), $MachinePrecision], N[(N[(d4 - d1), $MachinePrecision] * d1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 8.6 \cdot 10^{+70}:\\
\;\;\;\;\left(d2 - d3\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;\left(d4 - d1\right) \cdot d1\\
\end{array}
\end{array}
if d4 < 8.6000000000000002e70Initial program 88.4%
Taylor expanded in d1 around 0
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6484.1
Applied rewrites84.1%
Taylor expanded in d4 around 0
Applied rewrites65.9%
if 8.6000000000000002e70 < d4 Initial program 75.6%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6495.1
Applied rewrites95.1%
Taylor expanded in d2 around 0
Applied rewrites78.1%
Final simplification67.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 1.02e+37) (* (- d2 d1) d1) (* (+ d2 d4) d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.02e+37) {
tmp = (d2 - d1) * d1;
} else {
tmp = (d2 + d4) * d1;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 1.02d+37) then
tmp = (d2 - d1) * d1
else
tmp = (d2 + d4) * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 1.02e+37) {
tmp = (d2 - d1) * d1;
} else {
tmp = (d2 + d4) * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 1.02e+37: tmp = (d2 - d1) * d1 else: tmp = (d2 + d4) * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 1.02e+37) tmp = Float64(Float64(d2 - d1) * d1); else tmp = Float64(Float64(d2 + d4) * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 1.02e+37) tmp = (d2 - d1) * d1; else tmp = (d2 + d4) * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 1.02e+37], N[(N[(d2 - d1), $MachinePrecision] * d1), $MachinePrecision], N[(N[(d2 + d4), $MachinePrecision] * d1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 1.02 \cdot 10^{+37}:\\
\;\;\;\;\left(d2 - d1\right) \cdot d1\\
\mathbf{else}:\\
\;\;\;\;\left(d2 + d4\right) \cdot d1\\
\end{array}
\end{array}
if d4 < 1.01999999999999995e37Initial program 88.7%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6475.4
Applied rewrites75.4%
Taylor expanded in d4 around 0
Applied rewrites59.6%
if 1.01999999999999995e37 < d4 Initial program 76.9%
Taylor expanded in d3 around 0
distribute-lft-outN/A
unpow2N/A
distribute-lft-out--N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6487.9
Applied rewrites87.9%
Taylor expanded in d1 around 0
Applied rewrites74.6%
Final simplification62.7%
(FPCore (d1 d2 d3 d4) :precision binary64 (if (<= d4 8e-12) (* d2 d1) (* d4 d1)))
double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8e-12) {
tmp = d2 * d1;
} else {
tmp = d4 * d1;
}
return tmp;
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
real(8) :: tmp
if (d4 <= 8d-12) then
tmp = d2 * d1
else
tmp = d4 * d1
end if
code = tmp
end function
public static double code(double d1, double d2, double d3, double d4) {
double tmp;
if (d4 <= 8e-12) {
tmp = d2 * d1;
} else {
tmp = d4 * d1;
}
return tmp;
}
def code(d1, d2, d3, d4): tmp = 0 if d4 <= 8e-12: tmp = d2 * d1 else: tmp = d4 * d1 return tmp
function code(d1, d2, d3, d4) tmp = 0.0 if (d4 <= 8e-12) tmp = Float64(d2 * d1); else tmp = Float64(d4 * d1); end return tmp end
function tmp_2 = code(d1, d2, d3, d4) tmp = 0.0; if (d4 <= 8e-12) tmp = d2 * d1; else tmp = d4 * d1; end tmp_2 = tmp; end
code[d1_, d2_, d3_, d4_] := If[LessEqual[d4, 8e-12], N[(d2 * d1), $MachinePrecision], N[(d4 * d1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;d4 \leq 8 \cdot 10^{-12}:\\
\;\;\;\;d2 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d4 \cdot d1\\
\end{array}
\end{array}
if d4 < 7.99999999999999984e-12Initial program 88.4%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6497.4
Applied rewrites97.4%
Taylor expanded in d2 around inf
*-commutativeN/A
lower-*.f6439.8
Applied rewrites39.8%
if 7.99999999999999984e-12 < d4 Initial program 80.3%
Taylor expanded in d4 around inf
*-commutativeN/A
lower-*.f6443.8
Applied rewrites43.8%
Final simplification40.8%
(FPCore (d1 d2 d3 d4) :precision binary64 (* d2 d1))
double code(double d1, double d2, double d3, double d4) {
return d2 * 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 = d2 * d1
end function
public static double code(double d1, double d2, double d3, double d4) {
return d2 * d1;
}
def code(d1, d2, d3, d4): return d2 * d1
function code(d1, d2, d3, d4) return Float64(d2 * d1) end
function tmp = code(d1, d2, d3, d4) tmp = d2 * d1; end
code[d1_, d2_, d3_, d4_] := N[(d2 * d1), $MachinePrecision]
\begin{array}{l}
\\
d2 \cdot d1
\end{array}
Initial program 86.3%
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift--.f64N/A
lift-*.f64N/A
fp-cancel-sub-sign-invN/A
associate-+l+N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lift-*.f64N/A
lift-*.f64N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower--.f6496.5
Applied rewrites96.5%
Taylor expanded in d2 around inf
*-commutativeN/A
lower-*.f6437.4
Applied rewrites37.4%
(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 2024343
(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)))