
(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) (- (+ t1 u))))
double code(double u, double v, double t1) {
return ((v / (t1 + u)) * t1) / -(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 = ((v / (t1 + u)) * t1) / -(t1 + u)
end function
public static double code(double u, double v, double t1) {
return ((v / (t1 + u)) * t1) / -(t1 + u);
}
def code(u, v, t1): return ((v / (t1 + u)) * t1) / -(t1 + u)
function code(u, v, t1) return Float64(Float64(Float64(v / Float64(t1 + u)) * t1) / Float64(-Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = ((v / (t1 + u)) * t1) / -(t1 + u); end
code[u_, v_, t1_] := N[(N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision] / (-N[(t1 + u), $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{t1 + u} \cdot t1}{-\left(t1 + u\right)}
\end{array}
Initial program 70.1%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
lift-neg.f64N/A
distribute-frac-negN/A
distribute-frac-neg2N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-neg.f6497.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.8
Applied rewrites97.8%
Final simplification97.8%
(FPCore (u v t1)
:precision binary64
(if (<= u -3.45e+118)
(/ (* (* (/ -1.0 u) v) t1) u)
(if (<= u 3.6e+202)
(/ v (fma (- -2.0 (/ u t1)) u (- t1)))
(/ (* (/ (- v) u) t1) u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -3.45e+118) {
tmp = (((-1.0 / u) * v) * t1) / u;
} else if (u <= 3.6e+202) {
tmp = v / fma((-2.0 - (u / t1)), u, -t1);
} else {
tmp = ((-v / u) * t1) / u;
}
return tmp;
}
function code(u, v, t1) tmp = 0.0 if (u <= -3.45e+118) tmp = Float64(Float64(Float64(Float64(-1.0 / u) * v) * t1) / u); elseif (u <= 3.6e+202) tmp = Float64(v / fma(Float64(-2.0 - Float64(u / t1)), u, Float64(-t1))); else tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); end return tmp end
code[u_, v_, t1_] := If[LessEqual[u, -3.45e+118], N[(N[(N[(N[(-1.0 / u), $MachinePrecision] * v), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision], If[LessEqual[u, 3.6e+202], N[(v / N[(N[(-2.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision] * u + (-t1)), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.45 \cdot 10^{+118}:\\
\;\;\;\;\frac{\left(\frac{-1}{u} \cdot v\right) \cdot t1}{u}\\
\mathbf{elif}\;u \leq 3.6 \cdot 10^{+202}:\\
\;\;\;\;\frac{v}{\mathsf{fma}\left(-2 - \frac{u}{t1}, u, -t1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\end{array}
\end{array}
if u < -3.45000000000000001e118Initial program 73.1%
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-/.f6490.2
Applied rewrites90.2%
Applied rewrites75.7%
Applied rewrites93.5%
Applied rewrites93.6%
if -3.45000000000000001e118 < u < 3.60000000000000008e202Initial program 70.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6497.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.4
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.4
Applied rewrites97.4%
Taylor expanded in u around 0
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6466.8
Applied rewrites66.8%
lift-*.f64N/A
*-lft-identity66.8
Applied rewrites66.8%
Taylor expanded in u around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6497.4
Applied rewrites97.4%
if 3.60000000000000008e202 < u Initial program 61.7%
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-/.f6495.2
Applied rewrites95.2%
Applied rewrites62.6%
Applied rewrites95.3%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (fma -2.0 u (- t1)))))
(if (<= t1 -1.36e+78)
t_1
(if (<= t1 1.6e+81) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = v / fma(-2.0, u, -t1);
double tmp;
if (t1 <= -1.36e+78) {
tmp = t_1;
} else if (t1 <= 1.6e+81) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = t_1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(v / fma(-2.0, u, Float64(-t1))) tmp = 0.0 if (t1 <= -1.36e+78) tmp = t_1; elseif (t1 <= 1.6e+81) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); else tmp = t_1; end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(-2.0 * u + (-t1)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.36e+78], t$95$1, If[LessEqual[t1, 1.6e+81], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{\mathsf{fma}\left(-2, u, -t1\right)}\\
\mathbf{if}\;t1 \leq -1.36 \cdot 10^{+78}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.6 \cdot 10^{+81}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.35999999999999999e78 or 1.6e81 < t1 Initial program 49.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6496.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6496.2
Applied rewrites96.2%
Taylor expanded in u around 0
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6487.7
Applied rewrites87.7%
lift-*.f64N/A
*-lft-identity87.7
Applied rewrites87.7%
if -1.35999999999999999e78 < t1 < 1.6e81Initial program 83.3%
(FPCore (u v t1) :precision binary64 (if (<= u -1.6e-37) (/ t1 (* (/ (- u) v) u)) (if (<= u 5.5e+57) (/ (- v) t1) (/ (* (/ (- v) u) t1) u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.6e-37) {
tmp = t1 / ((-u / v) * u);
} else if (u <= 5.5e+57) {
tmp = -v / t1;
} else {
tmp = ((-v / u) * t1) / u;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= (-1.6d-37)) then
tmp = t1 / ((-u / v) * u)
else if (u <= 5.5d+57) then
tmp = -v / t1
else
tmp = ((-v / u) * t1) / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -1.6e-37) {
tmp = t1 / ((-u / v) * u);
} else if (u <= 5.5e+57) {
tmp = -v / t1;
} else {
tmp = ((-v / u) * t1) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.6e-37: tmp = t1 / ((-u / v) * u) elif u <= 5.5e+57: tmp = -v / t1 else: tmp = ((-v / u) * t1) / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.6e-37) tmp = Float64(t1 / Float64(Float64(Float64(-u) / v) * u)); elseif (u <= 5.5e+57) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -1.6e-37) tmp = t1 / ((-u / v) * u); elseif (u <= 5.5e+57) tmp = -v / t1; else tmp = ((-v / u) * t1) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.6e-37], N[(t1 / N[(N[((-u) / v), $MachinePrecision] * u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 5.5e+57], N[((-v) / t1), $MachinePrecision], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.6 \cdot 10^{-37}:\\
\;\;\;\;\frac{t1}{\frac{-u}{v} \cdot u}\\
\mathbf{elif}\;u \leq 5.5 \cdot 10^{+57}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\end{array}
\end{array}
if u < -1.5999999999999999e-37Initial program 77.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
frac-2negN/A
frac-timesN/A
metadata-evalN/A
lift-neg.f64N/A
remove-double-negN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-neg.f6491.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6491.6
Applied rewrites91.6%
Taylor expanded in u around inf
*-commutativeN/A
unpow2N/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6483.7
Applied rewrites83.7%
if -1.5999999999999999e-37 < u < 5.5000000000000002e57Initial program 65.4%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6479.0
Applied rewrites79.0%
if 5.5000000000000002e57 < u Initial program 72.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-/.f6478.7
Applied rewrites78.7%
Applied rewrites69.1%
Applied rewrites83.7%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (* (/ (- v) u) t1) u))) (if (<= u -1.12e-64) t_1 (if (<= u 5.5e+57) (/ (- v) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = ((-v / u) * t1) / u;
double tmp;
if (u <= -1.12e-64) {
tmp = t_1;
} else if (u <= 5.5e+57) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = ((-v / u) * t1) / u
if (u <= (-1.12d-64)) then
tmp = t_1
else if (u <= 5.5d+57) then
tmp = -v / t1
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = ((-v / u) * t1) / u;
double tmp;
if (u <= -1.12e-64) {
tmp = t_1;
} else if (u <= 5.5e+57) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = ((-v / u) * t1) / u tmp = 0 if u <= -1.12e-64: tmp = t_1 elif u <= 5.5e+57: tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(Float64(-v) / u) * t1) / u) tmp = 0.0 if (u <= -1.12e-64) tmp = t_1; elseif (u <= 5.5e+57) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = ((-v / u) * t1) / u; tmp = 0.0; if (u <= -1.12e-64) tmp = t_1; elseif (u <= 5.5e+57) tmp = -v / t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision]}, If[LessEqual[u, -1.12e-64], t$95$1, If[LessEqual[u, 5.5e+57], N[((-v) / t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\frac{-v}{u} \cdot t1}{u}\\
\mathbf{if}\;u \leq -1.12 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 5.5 \cdot 10^{+57}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -1.12e-64 or 5.5000000000000002e57 < u Initial program 76.0%
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.2
Applied rewrites79.2%
Applied rewrites69.1%
Applied rewrites82.6%
if -1.12e-64 < u < 5.5000000000000002e57Initial program 64.3%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6479.9
Applied rewrites79.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (fma -2.0 u (- t1)))))
(if (<= t1 -1.4e-62)
t_1
(if (<= t1 1.9e+26) (/ (* (/ (- t1) u) v) u) t_1))))
double code(double u, double v, double t1) {
double t_1 = v / fma(-2.0, u, -t1);
double tmp;
if (t1 <= -1.4e-62) {
tmp = t_1;
} else if (t1 <= 1.9e+26) {
tmp = ((-t1 / u) * v) / u;
} else {
tmp = t_1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(v / fma(-2.0, u, Float64(-t1))) tmp = 0.0 if (t1 <= -1.4e-62) tmp = t_1; elseif (t1 <= 1.9e+26) tmp = Float64(Float64(Float64(Float64(-t1) / u) * v) / u); else tmp = t_1; end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(-2.0 * u + (-t1)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.4e-62], t$95$1, If[LessEqual[t1, 1.9e+26], N[(N[(N[((-t1) / u), $MachinePrecision] * v), $MachinePrecision] / u), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{\mathsf{fma}\left(-2, u, -t1\right)}\\
\mathbf{if}\;t1 \leq -1.4 \cdot 10^{-62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.9 \cdot 10^{+26}:\\
\;\;\;\;\frac{\frac{-t1}{u} \cdot v}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.40000000000000001e-62 or 1.9000000000000001e26 < t1 Initial program 58.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6493.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.7
Applied rewrites93.7%
Taylor expanded in u around 0
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6482.6
Applied rewrites82.6%
lift-*.f64N/A
*-lft-identity82.6
Applied rewrites82.6%
if -1.40000000000000001e-62 < t1 < 1.9000000000000001e26Initial program 83.4%
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-/.f6475.8
Applied rewrites75.8%
Applied rewrites77.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (fma -2.0 u (- t1)))))
(if (<= t1 -1.4e-62)
t_1
(if (<= t1 4.4e-37) (/ (* (- t1) v) (* u u)) t_1))))
double code(double u, double v, double t1) {
double t_1 = v / fma(-2.0, u, -t1);
double tmp;
if (t1 <= -1.4e-62) {
tmp = t_1;
} else if (t1 <= 4.4e-37) {
tmp = (-t1 * v) / (u * u);
} else {
tmp = t_1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(v / fma(-2.0, u, Float64(-t1))) tmp = 0.0 if (t1 <= -1.4e-62) tmp = t_1; elseif (t1 <= 4.4e-37) tmp = Float64(Float64(Float64(-t1) * v) / Float64(u * u)); else tmp = t_1; end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(-2.0 * u + (-t1)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.4e-62], t$95$1, If[LessEqual[t1, 4.4e-37], N[(N[((-t1) * v), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{\mathsf{fma}\left(-2, u, -t1\right)}\\
\mathbf{if}\;t1 \leq -1.4 \cdot 10^{-62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 4.4 \cdot 10^{-37}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.40000000000000001e-62 or 4.40000000000000004e-37 < t1 Initial program 60.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6493.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.0
Applied rewrites93.0%
Taylor expanded in u around 0
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6480.2
Applied rewrites80.2%
lift-*.f64N/A
*-lft-identity80.2
Applied rewrites80.2%
if -1.40000000000000001e-62 < t1 < 4.40000000000000004e-37Initial program 83.3%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6478.9
Applied rewrites78.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (fma -2.0 u (- t1)))))
(if (<= t1 -1.4e-62)
t_1
(if (<= t1 4.4e-37) (* (/ v (* (- u) u)) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = v / fma(-2.0, u, -t1);
double tmp;
if (t1 <= -1.4e-62) {
tmp = t_1;
} else if (t1 <= 4.4e-37) {
tmp = (v / (-u * u)) * t1;
} else {
tmp = t_1;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(v / fma(-2.0, u, Float64(-t1))) tmp = 0.0 if (t1 <= -1.4e-62) tmp = t_1; elseif (t1 <= 4.4e-37) tmp = Float64(Float64(v / Float64(Float64(-u) * u)) * t1); else tmp = t_1; end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(-2.0 * u + (-t1)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.4e-62], t$95$1, If[LessEqual[t1, 4.4e-37], N[(N[(v / N[((-u) * u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{\mathsf{fma}\left(-2, u, -t1\right)}\\
\mathbf{if}\;t1 \leq -1.4 \cdot 10^{-62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 4.4 \cdot 10^{-37}:\\
\;\;\;\;\frac{v}{\left(-u\right) \cdot u} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.40000000000000001e-62 or 4.40000000000000004e-37 < t1 Initial program 60.5%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6493.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.0
Applied rewrites93.0%
Taylor expanded in u around 0
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6480.2
Applied rewrites80.2%
lift-*.f64N/A
*-lft-identity80.2
Applied rewrites80.2%
if -1.40000000000000001e-62 < t1 < 4.40000000000000004e-37Initial program 83.3%
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-/.f6478.2
Applied rewrites78.2%
Applied rewrites77.3%
Final simplification78.9%
(FPCore (u v t1) :precision binary64 (/ (* (/ t1 (+ t1 u)) v) (- (+ t1 u))))
double code(double u, double v, double t1) {
return ((t1 / (t1 + u)) * v) / -(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 / (t1 + u)) * v) / -(t1 + u)
end function
public static double code(double u, double v, double t1) {
return ((t1 / (t1 + u)) * v) / -(t1 + u);
}
def code(u, v, t1): return ((t1 / (t1 + u)) * v) / -(t1 + u)
function code(u, v, t1) return Float64(Float64(Float64(t1 / Float64(t1 + u)) * v) / Float64(-Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = ((t1 / (t1 + u)) * v) / -(t1 + u); end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision] / (-N[(t1 + u), $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t1}{t1 + u} \cdot v}{-\left(t1 + u\right)}
\end{array}
Initial program 70.1%
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-/.f6497.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.5
Applied rewrites97.5%
Final simplification97.5%
(FPCore (u v t1) :precision binary64 (if (<= u -1.35e+118) (/ v (* -2.0 u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.35e+118) {
tmp = v / (-2.0 * u);
} else {
tmp = -v / t1;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= (-1.35d+118)) then
tmp = v / ((-2.0d0) * u)
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -1.35e+118) {
tmp = v / (-2.0 * u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.35e+118: tmp = v / (-2.0 * u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.35e+118) tmp = Float64(v / Float64(-2.0 * u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -1.35e+118) tmp = v / (-2.0 * u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.35e+118], N[(v / N[(-2.0 * u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.35 \cdot 10^{+118}:\\
\;\;\;\;\frac{v}{-2 \cdot u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -1.35e118Initial program 73.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6483.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6483.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6483.2
Applied rewrites83.2%
Taylor expanded in u around 0
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6444.0
Applied rewrites44.0%
lift-*.f64N/A
*-lft-identity44.0
Applied rewrites44.0%
Taylor expanded in u around inf
Applied rewrites37.7%
if -1.35e118 < u Initial program 69.5%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6460.8
Applied rewrites60.8%
(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(v / fma(-2.0, u, Float64(-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 70.1%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
frac-timesN/A
lower-/.f64N/A
lower-*.f64N/A
lower-*.f64N/A
frac-2negN/A
lift-neg.f64N/A
remove-double-negN/A
lower-/.f64N/A
lower-neg.f6492.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6492.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6492.9
Applied rewrites92.9%
Taylor expanded in u around 0
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6460.4
Applied rewrites60.4%
lift-*.f64N/A
*-lft-identity60.4
Applied rewrites60.4%
(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 70.1%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.9
Applied rewrites53.9%
herbie shell --seed 2024254
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))