
(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 10 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 + u)) / Float64(Float64(Float64(-t1) - 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 + u), $MachinePrecision]), $MachinePrecision] / N[(N[((-t1) - u), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{t1 + u}}{\frac{\left(-t1\right) - u}{t1}}
\end{array}
Initial program 69.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lower-neg.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
Final simplification98.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (- (* u -2.0) t1))))
(if (<= t1 -2.6e+158)
t_1
(if (<= t1 6.8e+140) (* v (/ (- t1) (* (+ t1 u) (+ t1 u)))) t_1))))
double code(double u, double v, double t1) {
double t_1 = v / ((u * -2.0) - t1);
double tmp;
if (t1 <= -2.6e+158) {
tmp = t_1;
} else if (t1 <= 6.8e+140) {
tmp = v * (-t1 / ((t1 + u) * (t1 + u)));
} 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 * (-2.0d0)) - t1)
if (t1 <= (-2.6d+158)) then
tmp = t_1
else if (t1 <= 6.8d+140) then
tmp = v * (-t1 / ((t1 + u) * (t1 + u)))
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 * -2.0) - t1);
double tmp;
if (t1 <= -2.6e+158) {
tmp = t_1;
} else if (t1 <= 6.8e+140) {
tmp = v * (-t1 / ((t1 + u) * (t1 + u)));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = v / ((u * -2.0) - t1) tmp = 0 if t1 <= -2.6e+158: tmp = t_1 elif t1 <= 6.8e+140: tmp = v * (-t1 / ((t1 + u) * (t1 + u))) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(v / Float64(Float64(u * -2.0) - t1)) tmp = 0.0 if (t1 <= -2.6e+158) tmp = t_1; elseif (t1 <= 6.8e+140) tmp = Float64(v * Float64(Float64(-t1) / Float64(Float64(t1 + u) * Float64(t1 + u)))); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v / ((u * -2.0) - t1); tmp = 0.0; if (t1 <= -2.6e+158) tmp = t_1; elseif (t1 <= 6.8e+140) tmp = v * (-t1 / ((t1 + u) * (t1 + u))); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2.6e+158], t$95$1, If[LessEqual[t1, 6.8e+140], N[(v * N[((-t1) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{u \cdot -2 - t1}\\
\mathbf{if}\;t1 \leq -2.6 \cdot 10^{+158}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 6.8 \cdot 10^{+140}:\\
\;\;\;\;v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -2.6e158 or 6.8e140 < t1 Initial program 28.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lower-neg.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in t1 around 0
div-subN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
lower--.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6494.1
Applied rewrites94.1%
Taylor expanded in u around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6485.8
Applied rewrites85.8%
if -2.6e158 < t1 < 6.8e140Initial program 83.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6490.7
Applied rewrites90.7%
Final simplification89.5%
(FPCore (u v t1) :precision binary64 (/ (/ v (+ t1 u)) (- -1.0 (/ u t1))))
double code(double u, double v, double t1) {
return (v / (t1 + u)) / (-1.0 - (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)) / ((-1.0d0) - (u / t1))
end function
public static double code(double u, double v, double t1) {
return (v / (t1 + u)) / (-1.0 - (u / t1));
}
def code(u, v, t1): return (v / (t1 + u)) / (-1.0 - (u / t1))
function code(u, v, t1) return Float64(Float64(v / Float64(t1 + u)) / Float64(-1.0 - Float64(u / t1))) end
function tmp = code(u, v, t1) tmp = (v / (t1 + u)) / (-1.0 - (u / t1)); end
code[u_, v_, t1_] := N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{t1 + u}}{-1 - \frac{u}{t1}}
\end{array}
Initial program 69.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lower-neg.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
Taylor expanded in t1 around 0
div-subN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
lower--.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (- (* u -2.0) t1))))
(if (<= t1 -7.2e-79)
t_1
(if (<= t1 2.1e-35) (* v (/ (- t1) (* u u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = v / ((u * -2.0) - t1);
double tmp;
if (t1 <= -7.2e-79) {
tmp = t_1;
} else if (t1 <= 2.1e-35) {
tmp = v * (-t1 / (u * u));
} 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 * (-2.0d0)) - t1)
if (t1 <= (-7.2d-79)) then
tmp = t_1
else if (t1 <= 2.1d-35) then
tmp = v * (-t1 / (u * u))
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 * -2.0) - t1);
double tmp;
if (t1 <= -7.2e-79) {
tmp = t_1;
} else if (t1 <= 2.1e-35) {
tmp = v * (-t1 / (u * u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = v / ((u * -2.0) - t1) tmp = 0 if t1 <= -7.2e-79: tmp = t_1 elif t1 <= 2.1e-35: tmp = v * (-t1 / (u * u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(v / Float64(Float64(u * -2.0) - t1)) tmp = 0.0 if (t1 <= -7.2e-79) tmp = t_1; elseif (t1 <= 2.1e-35) tmp = Float64(v * Float64(Float64(-t1) / Float64(u * u))); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v / ((u * -2.0) - t1); tmp = 0.0; if (t1 <= -7.2e-79) tmp = t_1; elseif (t1 <= 2.1e-35) tmp = v * (-t1 / (u * u)); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -7.2e-79], t$95$1, If[LessEqual[t1, 2.1e-35], N[(v * N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{u \cdot -2 - t1}\\
\mathbf{if}\;t1 \leq -7.2 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 2.1 \cdot 10^{-35}:\\
\;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -7.2000000000000005e-79 or 2.1e-35 < t1 Initial program 61.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lower-neg.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in t1 around 0
div-subN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
lower--.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6494.5
Applied rewrites94.5%
Taylor expanded in u around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6479.0
Applied rewrites79.0%
if -7.2000000000000005e-79 < t1 < 2.1e-35Initial program 82.2%
Taylor expanded in t1 around 0
unpow2N/A
lower-*.f6474.8
Applied rewrites74.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-neg.f64N/A
distribute-rgt-neg-outN/A
distribute-lft-neg-outN/A
lift-neg.f64N/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6479.8
Applied rewrites79.8%
Final simplification79.3%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (- (* u -2.0) t1))))
(if (<= t1 -2.3e-80)
t_1
(if (<= t1 2.1e-35) (* t1 (/ v (* u (- u)))) t_1))))
double code(double u, double v, double t1) {
double t_1 = v / ((u * -2.0) - t1);
double tmp;
if (t1 <= -2.3e-80) {
tmp = t_1;
} else if (t1 <= 2.1e-35) {
tmp = t1 * (v / (u * -u));
} 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 * (-2.0d0)) - t1)
if (t1 <= (-2.3d-80)) then
tmp = t_1
else if (t1 <= 2.1d-35) then
tmp = t1 * (v / (u * -u))
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 * -2.0) - t1);
double tmp;
if (t1 <= -2.3e-80) {
tmp = t_1;
} else if (t1 <= 2.1e-35) {
tmp = t1 * (v / (u * -u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = v / ((u * -2.0) - t1) tmp = 0 if t1 <= -2.3e-80: tmp = t_1 elif t1 <= 2.1e-35: tmp = t1 * (v / (u * -u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(v / Float64(Float64(u * -2.0) - t1)) tmp = 0.0 if (t1 <= -2.3e-80) tmp = t_1; elseif (t1 <= 2.1e-35) tmp = Float64(t1 * Float64(v / Float64(u * Float64(-u)))); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v / ((u * -2.0) - t1); tmp = 0.0; if (t1 <= -2.3e-80) tmp = t_1; elseif (t1 <= 2.1e-35) tmp = t1 * (v / (u * -u)); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2.3e-80], t$95$1, If[LessEqual[t1, 2.1e-35], N[(t1 * N[(v / N[(u * (-u)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{u \cdot -2 - t1}\\
\mathbf{if}\;t1 \leq -2.3 \cdot 10^{-80}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 2.1 \cdot 10^{-35}:\\
\;\;\;\;t1 \cdot \frac{v}{u \cdot \left(-u\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -2.2999999999999998e-80 or 2.1e-35 < t1 Initial program 61.5%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lower-neg.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
Taylor expanded in t1 around 0
div-subN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
lower--.f64N/A
lower-/.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6494.5
Applied rewrites94.5%
Taylor expanded in u around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6479.0
Applied rewrites79.0%
if -2.2999999999999998e-80 < t1 < 2.1e-35Initial program 82.2%
Taylor expanded in t1 around 0
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
unpow2N/A
distribute-rgt-neg-inN/A
lower-*.f64N/A
lower-neg.f6475.0
Applied rewrites75.0%
(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(v / Float64(t1 + u)) * Float64(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[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(t1 / N[((-t1) - u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{t1 + u} \cdot \frac{t1}{\left(-t1\right) - u}
\end{array}
Initial program 69.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-neg.f64N/A
neg-mul-1N/A
associate-*r*N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
neg-mul-1N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
Final simplification98.0%
(FPCore (u v t1) :precision binary64 (/ v (* (+ t1 u) (- -1.0 (/ u t1)))))
double code(double u, double v, double t1) {
return v / ((t1 + u) * (-1.0 - (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) * ((-1.0d0) - (u / t1)))
end function
public static double code(double u, double v, double t1) {
return v / ((t1 + u) * (-1.0 - (u / t1)));
}
def code(u, v, t1): return v / ((t1 + u) * (-1.0 - (u / t1)))
function code(u, v, t1) return Float64(v / Float64(Float64(t1 + u) * Float64(-1.0 - Float64(u / t1)))) end
function tmp = code(u, v, t1) tmp = v / ((t1 + u) * (-1.0 - (u / t1))); end
code[u_, v_, t1_] := N[(v / N[(N[(t1 + u), $MachinePrecision] * N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}
\end{array}
Initial program 69.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lower-neg.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
Taylor expanded in v around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
+-commutativeN/A
*-lft-identityN/A
associate-*l/N/A
distribute-neg-inN/A
associate-*l/N/A
*-lft-identityN/A
mul-1-negN/A
sub-negN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
sub-negN/A
metadata-evalN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f6495.1
Applied rewrites95.1%
Final simplification95.1%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* (/ (- v) u) 1.0))) (if (<= u -2.1e+153) t_1 (if (<= u 2e+160) (/ v (- t1)) t_1))))
double code(double u, double v, double t1) {
double t_1 = (-v / u) * 1.0;
double tmp;
if (u <= -2.1e+153) {
tmp = t_1;
} else if (u <= 2e+160) {
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) * 1.0d0
if (u <= (-2.1d+153)) then
tmp = t_1
else if (u <= 2d+160) 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) * 1.0;
double tmp;
if (u <= -2.1e+153) {
tmp = t_1;
} else if (u <= 2e+160) {
tmp = v / -t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-v / u) * 1.0 tmp = 0 if u <= -2.1e+153: tmp = t_1 elif u <= 2e+160: tmp = v / -t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-v) / u) * 1.0) tmp = 0.0 if (u <= -2.1e+153) tmp = t_1; elseif (u <= 2e+160) tmp = Float64(v / Float64(-t1)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-v / u) * 1.0; tmp = 0.0; if (u <= -2.1e+153) tmp = t_1; elseif (u <= 2e+160) tmp = v / -t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-v) / u), $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[u, -2.1e+153], t$95$1, If[LessEqual[u, 2e+160], N[(v / (-t1)), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{u} \cdot 1\\
\mathbf{if}\;u \leq -2.1 \cdot 10^{+153}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 2 \cdot 10^{+160}:\\
\;\;\;\;\frac{v}{-t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -2.10000000000000017e153 or 2.00000000000000001e160 < u Initial program 72.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-neg.f64N/A
neg-mul-1N/A
associate-*r*N/A
lift-*.f64N/A
times-fracN/A
*-commutativeN/A
neg-mul-1N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6499.8
Applied rewrites99.8%
Taylor expanded in t1 around inf
Applied rewrites43.8%
Taylor expanded in t1 around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6435.6
Applied rewrites35.6%
if -2.10000000000000017e153 < u < 2.00000000000000001e160Initial program 68.7%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6464.0
Applied rewrites64.0%
Final simplification56.4%
(FPCore (u v t1) :precision binary64 (/ v (- (* u -2.0) t1)))
double code(double u, double v, double t1) {
return v / ((u * -2.0) - 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 * (-2.0d0)) - t1)
end function
public static double code(double u, double v, double t1) {
return v / ((u * -2.0) - t1);
}
def code(u, v, t1): return v / ((u * -2.0) - t1)
function code(u, v, t1) return Float64(v / Float64(Float64(u * -2.0) - t1)) end
function tmp = code(u, v, t1) tmp = v / ((u * -2.0) - t1); end
code[u_, v_, t1_] := N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u \cdot -2 - t1}
\end{array}
Initial program 69.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
lower-neg.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
Taylor expanded in t1 around 0
div-subN/A
associate-/l*N/A
*-inversesN/A
metadata-evalN/A
lower--.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/l/N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6495.1
Applied rewrites95.1%
Taylor expanded in u around 0
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
*-commutativeN/A
lower-*.f6460.0
Applied rewrites60.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(v / Float64(-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 69.7%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6451.2
Applied rewrites51.2%
Final simplification51.2%
herbie shell --seed 2024223
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))