
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
(FPCore (u v t1) :precision binary64 (/ (* v (/ t1 (+ u t1))) (- (- u) t1)))
double code(double u, double v, double t1) {
return (v * (t1 / (u + t1))) / (-u - t1);
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (v * (t1 / (u + t1))) / (-u - t1)
end function
public static double code(double u, double v, double t1) {
return (v * (t1 / (u + t1))) / (-u - t1);
}
def code(u, v, t1): return (v * (t1 / (u + t1))) / (-u - t1)
function code(u, v, t1) return Float64(Float64(v * Float64(t1 / Float64(u + t1))) / Float64(Float64(-u) - t1)) end
function tmp = code(u, v, t1) tmp = (v * (t1 / (u + t1))) / (-u - t1); end
code[u_, v_, t1_] := N[(N[(v * N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v \cdot \frac{t1}{u + t1}}{\left(-u\right) - t1}
\end{array}
Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6498.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.5
Applied rewrites98.5%
Final simplification98.5%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ (- v) (* (+ t1 u) (+ t1 u))) t1)))
(if (<= t1 -7e+99)
(/ (- v) (fma 2.0 u t1))
(if (<= t1 -9.2e-105)
t_1
(if (<= t1 8.5e-149)
(/ (* (/ t1 u) v) (- u))
(if (<= t1 1.6e+84) t_1 (/ (- v) t1)))))))
double code(double u, double v, double t1) {
double t_1 = (-v / ((t1 + u) * (t1 + u))) * t1;
double tmp;
if (t1 <= -7e+99) {
tmp = -v / fma(2.0, u, t1);
} else if (t1 <= -9.2e-105) {
tmp = t_1;
} else if (t1 <= 8.5e-149) {
tmp = ((t1 / u) * v) / -u;
} else if (t1 <= 1.6e+84) {
tmp = t_1;
} else {
tmp = -v / t1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(Float64(Float64(-v) / Float64(Float64(t1 + u) * Float64(t1 + u))) * t1) tmp = 0.0 if (t1 <= -7e+99) tmp = Float64(Float64(-v) / fma(2.0, u, t1)); elseif (t1 <= -9.2e-105) tmp = t_1; elseif (t1 <= 8.5e-149) tmp = Float64(Float64(Float64(t1 / u) * v) / Float64(-u)); elseif (t1 <= 1.6e+84) tmp = t_1; else tmp = Float64(Float64(-v) / t1); end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-v) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision]}, If[LessEqual[t1, -7e+99], N[((-v) / N[(2.0 * u + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -9.2e-105], t$95$1, If[LessEqual[t1, 8.5e-149], N[(N[(N[(t1 / u), $MachinePrecision] * v), $MachinePrecision] / (-u)), $MachinePrecision], If[LessEqual[t1, 1.6e+84], t$95$1, N[((-v) / t1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \cdot t1\\
\mathbf{if}\;t1 \leq -7 \cdot 10^{+99}:\\
\;\;\;\;\frac{-v}{\mathsf{fma}\left(2, u, t1\right)}\\
\mathbf{elif}\;t1 \leq -9.2 \cdot 10^{-105}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 8.5 \cdot 10^{-149}:\\
\;\;\;\;\frac{\frac{t1}{u} \cdot v}{-u}\\
\mathbf{elif}\;t1 \leq 1.6 \cdot 10^{+84}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -6.9999999999999995e99Initial program 55.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites96.3%
Taylor expanded in u around 0
+-commutativeN/A
lower-fma.f6490.0
Applied rewrites90.0%
if -6.9999999999999995e99 < t1 < -9.2000000000000004e-105 or 8.5000000000000006e-149 < t1 < 1.60000000000000005e84Initial program 89.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.8
Applied rewrites99.8%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites95.8%
lift-/.f64N/A
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
associate-/r/N/A
lower-*.f64N/A
lower-/.f64N/A
lower-*.f6494.2
Applied rewrites94.2%
if -9.2000000000000004e-105 < t1 < 8.5000000000000006e-149Initial program 84.5%
Taylor expanded in u around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
neg-mul-1N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6483.9
Applied rewrites83.9%
Applied rewrites86.5%
if 1.60000000000000005e84 < t1 Initial program 53.3%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6494.0
Applied rewrites94.0%
Final simplification91.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -7.5e-92) (not (<= t1 9.2e-21))) (/ (- v) (fma 2.0 u t1)) (/ (* (/ t1 u) v) (- u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -7.5e-92) || !(t1 <= 9.2e-21)) {
tmp = -v / fma(2.0, u, t1);
} else {
tmp = ((t1 / u) * v) / -u;
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if ((t1 <= -7.5e-92) || !(t1 <= 9.2e-21)) tmp = Float64(Float64(-v) / fma(2.0, u, t1)); else tmp = Float64(Float64(Float64(t1 / u) * v) / Float64(-u)); end return tmp end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -7.5e-92], N[Not[LessEqual[t1, 9.2e-21]], $MachinePrecision]], N[((-v) / N[(2.0 * u + t1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t1 / u), $MachinePrecision] * v), $MachinePrecision] / (-u)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7.5 \cdot 10^{-92} \lor \neg \left(t1 \leq 9.2 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{-v}{\mathsf{fma}\left(2, u, t1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t1}{u} \cdot v}{-u}\\
\end{array}
\end{array}
if t1 < -7.5000000000000005e-92 or 9.19999999999999998e-21 < t1 Initial program 69.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites96.4%
Taylor expanded in u around 0
+-commutativeN/A
lower-fma.f6485.7
Applied rewrites85.7%
if -7.5000000000000005e-92 < t1 < 9.19999999999999998e-21Initial program 85.6%
Taylor expanded in u around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
neg-mul-1N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6479.7
Applied rewrites79.7%
Applied rewrites81.5%
Final simplification83.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -7.5e-92) (not (<= t1 9.2e-21))) (/ (- v) (fma 2.0 u t1)) (* (/ t1 u) (/ (- v) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -7.5e-92) || !(t1 <= 9.2e-21)) {
tmp = -v / fma(2.0, u, t1);
} else {
tmp = (t1 / u) * (-v / u);
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if ((t1 <= -7.5e-92) || !(t1 <= 9.2e-21)) tmp = Float64(Float64(-v) / fma(2.0, u, t1)); else tmp = Float64(Float64(t1 / u) * Float64(Float64(-v) / u)); end return tmp end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -7.5e-92], N[Not[LessEqual[t1, 9.2e-21]], $MachinePrecision]], N[((-v) / N[(2.0 * u + t1), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / u), $MachinePrecision] * N[((-v) / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7.5 \cdot 10^{-92} \lor \neg \left(t1 \leq 9.2 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{-v}{\mathsf{fma}\left(2, u, t1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{-v}{u}\\
\end{array}
\end{array}
if t1 < -7.5000000000000005e-92 or 9.19999999999999998e-21 < t1 Initial program 69.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites96.4%
Taylor expanded in u around 0
+-commutativeN/A
lower-fma.f6485.7
Applied rewrites85.7%
if -7.5000000000000005e-92 < t1 < 9.19999999999999998e-21Initial program 85.6%
Taylor expanded in u around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
neg-mul-1N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6479.7
Applied rewrites79.7%
Final simplification83.1%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.02e+85) (/ (- v) (fma 2.0 u t1)) (if (<= t1 2.5e+86) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))) (/ (- v) t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.02e+85) {
tmp = -v / fma(2.0, u, t1);
} else if (t1 <= 2.5e+86) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = -v / t1;
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.02e+85) tmp = Float64(Float64(-v) / fma(2.0, u, t1)); elseif (t1 <= 2.5e+86) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); else tmp = Float64(Float64(-v) / t1); end return tmp end
code[u_, v_, t1_] := If[LessEqual[t1, -1.02e+85], N[((-v) / N[(2.0 * u + t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.5e+86], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.02 \cdot 10^{+85}:\\
\;\;\;\;\frac{-v}{\mathsf{fma}\left(2, u, t1\right)}\\
\mathbf{elif}\;t1 \leq 2.5 \cdot 10^{+86}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -1.02e85Initial program 57.3%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites96.6%
Taylor expanded in u around 0
+-commutativeN/A
lower-fma.f6491.0
Applied rewrites91.0%
if -1.02e85 < t1 < 2.4999999999999999e86Initial program 87.5%
if 2.4999999999999999e86 < t1 Initial program 51.3%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6495.8
Applied rewrites95.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -7.5e-92) (not (<= t1 9.2e-21))) (/ (- v) (fma 2.0 u t1)) (/ (* (- t1) v) (* u u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -7.5e-92) || !(t1 <= 9.2e-21)) {
tmp = -v / fma(2.0, u, t1);
} else {
tmp = (-t1 * v) / (u * u);
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if ((t1 <= -7.5e-92) || !(t1 <= 9.2e-21)) tmp = Float64(Float64(-v) / fma(2.0, u, t1)); else tmp = Float64(Float64(Float64(-t1) * v) / Float64(u * u)); end return tmp end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -7.5e-92], N[Not[LessEqual[t1, 9.2e-21]], $MachinePrecision]], N[((-v) / N[(2.0 * u + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) * v), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7.5 \cdot 10^{-92} \lor \neg \left(t1 \leq 9.2 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{-v}{\mathsf{fma}\left(2, u, t1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -7.5000000000000005e-92 or 9.19999999999999998e-21 < t1 Initial program 69.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites96.4%
Taylor expanded in u around 0
+-commutativeN/A
lower-fma.f6485.7
Applied rewrites85.7%
if -7.5000000000000005e-92 < t1 < 9.19999999999999998e-21Initial program 85.6%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6475.4
Applied rewrites75.4%
Final simplification81.3%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -7e-92) (not (<= t1 9.2e-21))) (/ (- v) (fma 2.0 u t1)) (* v (/ (- t1) (* u u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -7e-92) || !(t1 <= 9.2e-21)) {
tmp = -v / fma(2.0, u, t1);
} else {
tmp = v * (-t1 / (u * u));
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if ((t1 <= -7e-92) || !(t1 <= 9.2e-21)) tmp = Float64(Float64(-v) / fma(2.0, u, t1)); else tmp = Float64(v * Float64(Float64(-t1) / Float64(u * u))); end return tmp end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -7e-92], N[Not[LessEqual[t1, 9.2e-21]], $MachinePrecision]], N[((-v) / N[(2.0 * u + t1), $MachinePrecision]), $MachinePrecision], N[(v * N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7 \cdot 10^{-92} \lor \neg \left(t1 \leq 9.2 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{-v}{\mathsf{fma}\left(2, u, t1\right)}\\
\mathbf{else}:\\
\;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -7e-92 or 9.19999999999999998e-21 < t1 Initial program 69.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites96.4%
Taylor expanded in u around 0
+-commutativeN/A
lower-fma.f6485.7
Applied rewrites85.7%
if -7e-92 < t1 < 9.19999999999999998e-21Initial program 85.6%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6475.4
Applied rewrites75.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6472.6
Applied rewrites72.6%
Final simplification80.1%
(FPCore (u v t1) :precision binary64 (* (/ (- v) (+ u t1)) (/ t1 (+ u t1))))
double code(double u, double v, double t1) {
return (-v / (u + t1)) * (t1 / (u + t1));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-v / (u + t1)) * (t1 / (u + t1))
end function
public static double code(double u, double v, double t1) {
return (-v / (u + t1)) * (t1 / (u + t1));
}
def code(u, v, t1): return (-v / (u + t1)) * (t1 / (u + t1))
function code(u, v, t1) return Float64(Float64(Float64(-v) / Float64(u + t1)) * Float64(t1 / Float64(u + t1))) end
function tmp = code(u, v, t1) tmp = (-v / (u + t1)) * (t1 / (u + t1)); end
code[u_, v_, t1_] := N[(N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{u + t1} \cdot \frac{t1}{u + t1}
\end{array}
Initial program 76.2%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6497.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.7
Applied rewrites97.7%
(FPCore (u v t1) :precision binary64 (/ (- v) (fma (+ (/ u t1) 2.0) u t1)))
double code(double u, double v, double t1) {
return -v / fma(((u / t1) + 2.0), u, t1);
}
function code(u, v, t1) return Float64(Float64(-v) / fma(Float64(Float64(u / t1) + 2.0), u, t1)) end
code[u_, v_, t1_] := N[((-v) / N[(N[(N[(u / t1), $MachinePrecision] + 2.0), $MachinePrecision] * u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{\mathsf{fma}\left(\frac{u}{t1} + 2, u, t1\right)}
\end{array}
Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6498.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.5
Applied rewrites98.5%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites95.0%
Taylor expanded in u around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6495.0
Applied rewrites95.0%
(FPCore (u v t1) :precision binary64 (/ (- v) (fma 2.0 u t1)))
double code(double u, double v, double t1) {
return -v / fma(2.0, u, t1);
}
function code(u, v, t1) return Float64(Float64(-v) / fma(2.0, u, t1)) end
code[u_, v_, t1_] := N[((-v) / N[(2.0 * u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{\mathsf{fma}\left(2, u, t1\right)}
\end{array}
Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6498.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.5
Applied rewrites98.5%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6498.5
Applied rewrites98.5%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
div-invN/A
lift-/.f64N/A
clear-numN/A
lower-*.f64N/A
Applied rewrites95.0%
Taylor expanded in u around 0
+-commutativeN/A
lower-fma.f6465.4
Applied rewrites65.4%
(FPCore (u v t1) :precision binary64 (/ (- v) (+ u t1)))
double code(double u, double v, double t1) {
return -v / (u + t1);
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / (u + t1)
end function
public static double code(double u, double v, double t1) {
return -v / (u + t1);
}
def code(u, v, t1): return -v / (u + t1)
function code(u, v, t1) return Float64(Float64(-v) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = -v / (u + t1); end
code[u_, v_, t1_] := N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{u + t1}
\end{array}
Initial program 76.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6498.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.5
Applied rewrites98.5%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6465.0
Applied rewrites65.0%
(FPCore (u v t1) :precision binary64 (/ (- v) t1))
double code(double u, double v, double t1) {
return -v / t1;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / t1
end function
public static double code(double u, double v, double t1) {
return -v / t1;
}
def code(u, v, t1): return -v / t1
function code(u, v, t1) return Float64(Float64(-v) / t1) end
function tmp = code(u, v, t1) tmp = -v / t1; end
code[u_, v_, t1_] := N[((-v) / t1), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{t1}
\end{array}
Initial program 76.2%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6457.2
Applied rewrites57.2%
herbie shell --seed 2024302
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))