
(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 11 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 (/ (* (/ 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\right) - u}
\end{array}
Initial program 69.3%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
frac-2negN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-neg.f6499.8
Applied rewrites99.8%
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
remove-double-negN/A
lower-*.f6499.8
Applied rewrites99.8%
Final simplification99.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* v (/ (- t1) (* (+ t1 u) (+ t1 u))))))
(if (<= t1 -2.6e+159)
(- (* 1.0 (/ v (+ t1 u))))
(if (<= t1 -4.7e-155)
t_1
(if (<= t1 2.5e-188)
(/ (* v (/ t1 u)) (- (- t1) u))
(if (<= t1 5.8e+75) t_1 (* (/ t1 (+ t1 u)) (/ v (- t1)))))))))
double code(double u, double v, double t1) {
double t_1 = v * (-t1 / ((t1 + u) * (t1 + u)));
double tmp;
if (t1 <= -2.6e+159) {
tmp = -(1.0 * (v / (t1 + u)));
} else if (t1 <= -4.7e-155) {
tmp = t_1;
} else if (t1 <= 2.5e-188) {
tmp = (v * (t1 / u)) / (-t1 - u);
} else if (t1 <= 5.8e+75) {
tmp = t_1;
} else {
tmp = (t1 / (t1 + u)) * (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) :: t_1
real(8) :: tmp
t_1 = v * (-t1 / ((t1 + u) * (t1 + u)))
if (t1 <= (-2.6d+159)) then
tmp = -(1.0d0 * (v / (t1 + u)))
else if (t1 <= (-4.7d-155)) then
tmp = t_1
else if (t1 <= 2.5d-188) then
tmp = (v * (t1 / u)) / (-t1 - u)
else if (t1 <= 5.8d+75) then
tmp = t_1
else
tmp = (t1 / (t1 + u)) * (v / -t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = v * (-t1 / ((t1 + u) * (t1 + u)));
double tmp;
if (t1 <= -2.6e+159) {
tmp = -(1.0 * (v / (t1 + u)));
} else if (t1 <= -4.7e-155) {
tmp = t_1;
} else if (t1 <= 2.5e-188) {
tmp = (v * (t1 / u)) / (-t1 - u);
} else if (t1 <= 5.8e+75) {
tmp = t_1;
} else {
tmp = (t1 / (t1 + u)) * (v / -t1);
}
return tmp;
}
def code(u, v, t1): t_1 = v * (-t1 / ((t1 + u) * (t1 + u))) tmp = 0 if t1 <= -2.6e+159: tmp = -(1.0 * (v / (t1 + u))) elif t1 <= -4.7e-155: tmp = t_1 elif t1 <= 2.5e-188: tmp = (v * (t1 / u)) / (-t1 - u) elif t1 <= 5.8e+75: tmp = t_1 else: tmp = (t1 / (t1 + u)) * (v / -t1) return tmp
function code(u, v, t1) t_1 = Float64(v * Float64(Float64(-t1) / Float64(Float64(t1 + u) * Float64(t1 + u)))) tmp = 0.0 if (t1 <= -2.6e+159) tmp = Float64(-Float64(1.0 * Float64(v / Float64(t1 + u)))); elseif (t1 <= -4.7e-155) tmp = t_1; elseif (t1 <= 2.5e-188) tmp = Float64(Float64(v * Float64(t1 / u)) / Float64(Float64(-t1) - u)); elseif (t1 <= 5.8e+75) tmp = t_1; else tmp = Float64(Float64(t1 / Float64(t1 + u)) * Float64(v / Float64(-t1))); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v * (-t1 / ((t1 + u) * (t1 + u))); tmp = 0.0; if (t1 <= -2.6e+159) tmp = -(1.0 * (v / (t1 + u))); elseif (t1 <= -4.7e-155) tmp = t_1; elseif (t1 <= 2.5e-188) tmp = (v * (t1 / u)) / (-t1 - u); elseif (t1 <= 5.8e+75) tmp = t_1; else tmp = (t1 / (t1 + u)) * (v / -t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v * N[((-t1) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2.6e+159], (-N[(1.0 * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[t1, -4.7e-155], t$95$1, If[LessEqual[t1, 2.5e-188], N[(N[(v * N[(t1 / u), $MachinePrecision]), $MachinePrecision] / N[((-t1) - u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 5.8e+75], t$95$1, N[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(v / (-t1)), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -2.6 \cdot 10^{+159}:\\
\;\;\;\;-1 \cdot \frac{v}{t1 + u}\\
\mathbf{elif}\;t1 \leq -4.7 \cdot 10^{-155}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 2.5 \cdot 10^{-188}:\\
\;\;\;\;\frac{v \cdot \frac{t1}{u}}{\left(-t1\right) - u}\\
\mathbf{elif}\;t1 \leq 5.8 \cdot 10^{+75}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{t1 + u} \cdot \frac{v}{-t1}\\
\end{array}
\end{array}
if t1 < -2.6e159Initial program 39.8%
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-/.f64100.0
Applied rewrites100.0%
Taylor expanded in t1 around inf
Applied rewrites97.8%
if -2.6e159 < t1 < -4.6999999999999998e-155 or 2.5e-188 < t1 < 5.7999999999999997e75Initial program 84.9%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6494.5
Applied rewrites94.5%
if -4.6999999999999998e-155 < t1 < 2.5e-188Initial program 78.2%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
times-fracN/A
frac-2negN/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
lift-neg.f64N/A
distribute-frac-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
lift-neg.f64N/A
remove-double-negN/A
lower-*.f6499.7
Applied rewrites99.7%
Taylor expanded in t1 around 0
lower-/.f6494.5
Applied rewrites94.5%
if 5.7999999999999997e75 < t1 Initial program 47.5%
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.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6484.4
Applied rewrites84.4%
Final simplification92.8%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -2.6e+159)
(- (* 1.0 (/ v (+ t1 u))))
(if (<= t1 5.8e+75)
(* v (/ (- t1) (* (+ t1 u) (+ t1 u))))
(* (/ t1 (+ t1 u)) (/ v (- t1))))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.6e+159) {
tmp = -(1.0 * (v / (t1 + u)));
} else if (t1 <= 5.8e+75) {
tmp = v * (-t1 / ((t1 + u) * (t1 + u)));
} else {
tmp = (t1 / (t1 + u)) * (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 (t1 <= (-2.6d+159)) then
tmp = -(1.0d0 * (v / (t1 + u)))
else if (t1 <= 5.8d+75) then
tmp = v * (-t1 / ((t1 + u) * (t1 + u)))
else
tmp = (t1 / (t1 + u)) * (v / -t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.6e+159) {
tmp = -(1.0 * (v / (t1 + u)));
} else if (t1 <= 5.8e+75) {
tmp = v * (-t1 / ((t1 + u) * (t1 + u)));
} else {
tmp = (t1 / (t1 + u)) * (v / -t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -2.6e+159: tmp = -(1.0 * (v / (t1 + u))) elif t1 <= 5.8e+75: tmp = v * (-t1 / ((t1 + u) * (t1 + u))) else: tmp = (t1 / (t1 + u)) * (v / -t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -2.6e+159) tmp = Float64(-Float64(1.0 * Float64(v / Float64(t1 + u)))); elseif (t1 <= 5.8e+75) tmp = Float64(v * Float64(Float64(-t1) / Float64(Float64(t1 + u) * Float64(t1 + u)))); else tmp = Float64(Float64(t1 / Float64(t1 + u)) * Float64(v / Float64(-t1))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -2.6e+159) tmp = -(1.0 * (v / (t1 + u))); elseif (t1 <= 5.8e+75) tmp = v * (-t1 / ((t1 + u) * (t1 + u))); else tmp = (t1 / (t1 + u)) * (v / -t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -2.6e+159], (-N[(1.0 * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[t1, 5.8e+75], N[(v * N[((-t1) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(v / (-t1)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.6 \cdot 10^{+159}:\\
\;\;\;\;-1 \cdot \frac{v}{t1 + u}\\
\mathbf{elif}\;t1 \leq 5.8 \cdot 10^{+75}:\\
\;\;\;\;v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{t1 + u} \cdot \frac{v}{-t1}\\
\end{array}
\end{array}
if t1 < -2.6e159Initial program 39.8%
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-/.f64100.0
Applied rewrites100.0%
Taylor expanded in t1 around inf
Applied rewrites97.8%
if -2.6e159 < t1 < 5.7999999999999997e75Initial program 82.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.5
Applied rewrites88.5%
if 5.7999999999999997e75 < t1 Initial program 47.5%
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.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6484.4
Applied rewrites84.4%
Final simplification88.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (* 1.0 (/ v (+ t1 u))))))
(if (<= t1 -2.6e+159)
t_1
(if (<= t1 5.8e+75) (* v (/ (- t1) (* (+ t1 u) (+ t1 u)))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -(1.0 * (v / (t1 + u)));
double tmp;
if (t1 <= -2.6e+159) {
tmp = t_1;
} else if (t1 <= 5.8e+75) {
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 = -(1.0d0 * (v / (t1 + u)))
if (t1 <= (-2.6d+159)) then
tmp = t_1
else if (t1 <= 5.8d+75) 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 = -(1.0 * (v / (t1 + u)));
double tmp;
if (t1 <= -2.6e+159) {
tmp = t_1;
} else if (t1 <= 5.8e+75) {
tmp = v * (-t1 / ((t1 + u) * (t1 + u)));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -(1.0 * (v / (t1 + u))) tmp = 0 if t1 <= -2.6e+159: tmp = t_1 elif t1 <= 5.8e+75: tmp = v * (-t1 / ((t1 + u) * (t1 + u))) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(-Float64(1.0 * Float64(v / Float64(t1 + u)))) tmp = 0.0 if (t1 <= -2.6e+159) tmp = t_1; elseif (t1 <= 5.8e+75) 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 = -(1.0 * (v / (t1 + u))); tmp = 0.0; if (t1 <= -2.6e+159) tmp = t_1; elseif (t1 <= 5.8e+75) 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[(1.0 * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t1, -2.6e+159], t$95$1, If[LessEqual[t1, 5.8e+75], 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 := -1 \cdot \frac{v}{t1 + u}\\
\mathbf{if}\;t1 \leq -2.6 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 5.8 \cdot 10^{+75}:\\
\;\;\;\;v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -2.6e159 or 5.7999999999999997e75 < t1 Initial program 44.5%
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.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
Applied rewrites89.6%
if -2.6e159 < t1 < 5.7999999999999997e75Initial program 82.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.5
Applied rewrites88.5%
Final simplification88.9%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (- (* 1.0 (/ v (+ t1 u)))))) (if (<= t1 -3.1e-145) t_1 (if (<= t1 9e-35) (* (/ t1 u) (- (/ v u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -(1.0 * (v / (t1 + u)));
double tmp;
if (t1 <= -3.1e-145) {
tmp = t_1;
} else if (t1 <= 9e-35) {
tmp = (t1 / u) * -(v / 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 = -(1.0d0 * (v / (t1 + u)))
if (t1 <= (-3.1d-145)) then
tmp = t_1
else if (t1 <= 9d-35) then
tmp = (t1 / u) * -(v / u)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -(1.0 * (v / (t1 + u)));
double tmp;
if (t1 <= -3.1e-145) {
tmp = t_1;
} else if (t1 <= 9e-35) {
tmp = (t1 / u) * -(v / u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -(1.0 * (v / (t1 + u))) tmp = 0 if t1 <= -3.1e-145: tmp = t_1 elif t1 <= 9e-35: tmp = (t1 / u) * -(v / u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(-Float64(1.0 * Float64(v / Float64(t1 + u)))) tmp = 0.0 if (t1 <= -3.1e-145) tmp = t_1; elseif (t1 <= 9e-35) tmp = Float64(Float64(t1 / u) * Float64(-Float64(v / u))); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -(1.0 * (v / (t1 + u))); tmp = 0.0; if (t1 <= -3.1e-145) tmp = t_1; elseif (t1 <= 9e-35) tmp = (t1 / u) * -(v / u); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = (-N[(1.0 * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t1, -3.1e-145], t$95$1, If[LessEqual[t1, 9e-35], N[(N[(t1 / u), $MachinePrecision] * (-N[(v / u), $MachinePrecision])), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \frac{v}{t1 + u}\\
\mathbf{if}\;t1 \leq -3.1 \cdot 10^{-145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 9 \cdot 10^{-35}:\\
\;\;\;\;\frac{t1}{u} \cdot \left(-\frac{v}{u}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -3.1e-145 or 9.0000000000000002e-35 < t1 Initial program 61.8%
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.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
Applied rewrites80.1%
if -3.1e-145 < t1 < 9.0000000000000002e-35Initial program 82.0%
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-/.f6496.7
Applied rewrites96.7%
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.f6481.8
Applied rewrites81.8%
Taylor expanded in t1 around 0
lower-/.f6485.3
Applied rewrites85.3%
Final simplification82.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (* 1.0 (/ v (+ t1 u))))))
(if (<= t1 -3.1e-145)
t_1
(if (<= t1 8.5e-113) (* v (/ (- t1) (* u u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -(1.0 * (v / (t1 + u)));
double tmp;
if (t1 <= -3.1e-145) {
tmp = t_1;
} else if (t1 <= 8.5e-113) {
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 = -(1.0d0 * (v / (t1 + u)))
if (t1 <= (-3.1d-145)) then
tmp = t_1
else if (t1 <= 8.5d-113) 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 = -(1.0 * (v / (t1 + u)));
double tmp;
if (t1 <= -3.1e-145) {
tmp = t_1;
} else if (t1 <= 8.5e-113) {
tmp = v * (-t1 / (u * u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -(1.0 * (v / (t1 + u))) tmp = 0 if t1 <= -3.1e-145: tmp = t_1 elif t1 <= 8.5e-113: tmp = v * (-t1 / (u * u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(-Float64(1.0 * Float64(v / Float64(t1 + u)))) tmp = 0.0 if (t1 <= -3.1e-145) tmp = t_1; elseif (t1 <= 8.5e-113) 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 = -(1.0 * (v / (t1 + u))); tmp = 0.0; if (t1 <= -3.1e-145) tmp = t_1; elseif (t1 <= 8.5e-113) tmp = v * (-t1 / (u * u)); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = (-N[(1.0 * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t1, -3.1e-145], t$95$1, If[LessEqual[t1, 8.5e-113], N[(v * N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \frac{v}{t1 + u}\\
\mathbf{if}\;t1 \leq -3.1 \cdot 10^{-145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 8.5 \cdot 10^{-113}:\\
\;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -3.1e-145 or 8.4999999999999995e-113 < t1 Initial program 63.9%
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.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
Applied rewrites77.5%
if -3.1e-145 < t1 < 8.4999999999999995e-113Initial program 81.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6482.4
Applied rewrites82.4%
Taylor expanded in t1 around 0
unpow2N/A
lower-*.f6481.2
Applied rewrites81.2%
Final simplification78.6%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (* 1.0 (/ v (+ t1 u))))))
(if (<= t1 -3.1e-145)
t_1
(if (<= t1 8.5e-113) (- (* t1 (/ v (* u u)))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -(1.0 * (v / (t1 + u)));
double tmp;
if (t1 <= -3.1e-145) {
tmp = t_1;
} else if (t1 <= 8.5e-113) {
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 = -(1.0d0 * (v / (t1 + u)))
if (t1 <= (-3.1d-145)) then
tmp = t_1
else if (t1 <= 8.5d-113) 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 = -(1.0 * (v / (t1 + u)));
double tmp;
if (t1 <= -3.1e-145) {
tmp = t_1;
} else if (t1 <= 8.5e-113) {
tmp = -(t1 * (v / (u * u)));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -(1.0 * (v / (t1 + u))) tmp = 0 if t1 <= -3.1e-145: tmp = t_1 elif t1 <= 8.5e-113: tmp = -(t1 * (v / (u * u))) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(-Float64(1.0 * Float64(v / Float64(t1 + u)))) tmp = 0.0 if (t1 <= -3.1e-145) tmp = t_1; elseif (t1 <= 8.5e-113) tmp = Float64(-Float64(t1 * Float64(v / Float64(u * u)))); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -(1.0 * (v / (t1 + u))); tmp = 0.0; if (t1 <= -3.1e-145) tmp = t_1; elseif (t1 <= 8.5e-113) tmp = -(t1 * (v / (u * u))); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = (-N[(1.0 * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, If[LessEqual[t1, -3.1e-145], t$95$1, If[LessEqual[t1, 8.5e-113], (-N[(t1 * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 \cdot \frac{v}{t1 + u}\\
\mathbf{if}\;t1 \leq -3.1 \cdot 10^{-145}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 8.5 \cdot 10^{-113}:\\
\;\;\;\;-t1 \cdot \frac{v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -3.1e-145 or 8.4999999999999995e-113 < t1 Initial program 63.9%
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.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
Applied rewrites77.5%
if -3.1e-145 < t1 < 8.4999999999999995e-113Initial program 81.8%
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.f6476.6
Applied rewrites76.6%
Final simplification77.2%
(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(t1 / Float64(t1 + u)) * Float64(-Float64(v / Float64(t1 + u)))) end
function tmp = code(u, v, t1) tmp = (t1 / (t1 + u)) * -(v / (t1 + u)); end
code[u_, v_, t1_] := N[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * (-N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
\\
\frac{t1}{t1 + u} \cdot \left(-\frac{v}{t1 + u}\right)
\end{array}
Initial program 69.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-/.f6498.7
Applied rewrites98.7%
Final simplification98.7%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* 1.0 (- (/ v u))))) (if (<= u -2.6e+87) t_1 (if (<= u 2.4e+179) (/ v (- t1)) t_1))))
double code(double u, double v, double t1) {
double t_1 = 1.0 * -(v / u);
double tmp;
if (u <= -2.6e+87) {
tmp = t_1;
} else if (u <= 2.4e+179) {
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 = 1.0d0 * -(v / u)
if (u <= (-2.6d+87)) then
tmp = t_1
else if (u <= 2.4d+179) 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 = 1.0 * -(v / u);
double tmp;
if (u <= -2.6e+87) {
tmp = t_1;
} else if (u <= 2.4e+179) {
tmp = v / -t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = 1.0 * -(v / u) tmp = 0 if u <= -2.6e+87: tmp = t_1 elif u <= 2.4e+179: tmp = v / -t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(1.0 * Float64(-Float64(v / u))) tmp = 0.0 if (u <= -2.6e+87) tmp = t_1; elseif (u <= 2.4e+179) tmp = Float64(v / Float64(-t1)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = 1.0 * -(v / u); tmp = 0.0; if (u <= -2.6e+87) tmp = t_1; elseif (u <= 2.4e+179) tmp = v / -t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(1.0 * (-N[(v / u), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[u, -2.6e+87], t$95$1, If[LessEqual[u, 2.4e+179], N[(v / (-t1)), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 \cdot \left(-\frac{v}{u}\right)\\
\mathbf{if}\;u \leq -2.6 \cdot 10^{+87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 2.4 \cdot 10^{+179}:\\
\;\;\;\;\frac{v}{-t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -2.59999999999999998e87 or 2.40000000000000013e179 < u Initial program 78.8%
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 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6494.9
Applied rewrites94.9%
Taylor expanded in t1 around inf
Applied rewrites35.2%
if -2.59999999999999998e87 < u < 2.40000000000000013e179Initial program 65.5%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6470.3
Applied rewrites70.3%
Final simplification60.3%
(FPCore (u v t1) :precision binary64 (- (* 1.0 (/ v (+ t1 u)))))
double code(double u, double v, double t1) {
return -(1.0 * (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 = -(1.0d0 * (v / (t1 + u)))
end function
public static double code(double u, double v, double t1) {
return -(1.0 * (v / (t1 + u)));
}
def code(u, v, t1): return -(1.0 * (v / (t1 + u)))
function code(u, v, t1) return Float64(-Float64(1.0 * Float64(v / Float64(t1 + u)))) end
function tmp = code(u, v, t1) tmp = -(1.0 * (v / (t1 + u))); end
code[u_, v_, t1_] := (-N[(1.0 * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])
\begin{array}{l}
\\
-1 \cdot \frac{v}{t1 + u}
\end{array}
Initial program 69.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-/.f6498.7
Applied rewrites98.7%
Taylor expanded in t1 around inf
Applied rewrites60.7%
Final simplification60.7%
(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.3%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6454.0
Applied rewrites54.0%
Final simplification54.0%
herbie shell --seed 2024221
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))