
(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 68.0%
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.f6497.6
Applied rewrites97.6%
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-*.f6497.6
Applied rewrites97.6%
Final simplification97.6%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (+ t1 u) (+ t1 u))) (t_2 (- (/ v t1))))
(if (<= t1 -5e+154)
t_2
(if (<= t1 -5.3e-182)
(* v (/ (- t1) t_1))
(if (<= t1 1.7e-246)
(* v (/ (/ t1 (- u)) (+ t1 u)))
(if (<= t1 1.95e+149) (* t1 (* v (/ -1.0 t_1))) t_2))))))
double code(double u, double v, double t1) {
double t_1 = (t1 + u) * (t1 + u);
double t_2 = -(v / t1);
double tmp;
if (t1 <= -5e+154) {
tmp = t_2;
} else if (t1 <= -5.3e-182) {
tmp = v * (-t1 / t_1);
} else if (t1 <= 1.7e-246) {
tmp = v * ((t1 / -u) / (t1 + u));
} else if (t1 <= 1.95e+149) {
tmp = t1 * (v * (-1.0 / t_1));
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (t1 + u) * (t1 + u)
t_2 = -(v / t1)
if (t1 <= (-5d+154)) then
tmp = t_2
else if (t1 <= (-5.3d-182)) then
tmp = v * (-t1 / t_1)
else if (t1 <= 1.7d-246) then
tmp = v * ((t1 / -u) / (t1 + u))
else if (t1 <= 1.95d+149) then
tmp = t1 * (v * ((-1.0d0) / t_1))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (t1 + u) * (t1 + u);
double t_2 = -(v / t1);
double tmp;
if (t1 <= -5e+154) {
tmp = t_2;
} else if (t1 <= -5.3e-182) {
tmp = v * (-t1 / t_1);
} else if (t1 <= 1.7e-246) {
tmp = v * ((t1 / -u) / (t1 + u));
} else if (t1 <= 1.95e+149) {
tmp = t1 * (v * (-1.0 / t_1));
} else {
tmp = t_2;
}
return tmp;
}
def code(u, v, t1): t_1 = (t1 + u) * (t1 + u) t_2 = -(v / t1) tmp = 0 if t1 <= -5e+154: tmp = t_2 elif t1 <= -5.3e-182: tmp = v * (-t1 / t_1) elif t1 <= 1.7e-246: tmp = v * ((t1 / -u) / (t1 + u)) elif t1 <= 1.95e+149: tmp = t1 * (v * (-1.0 / t_1)) else: tmp = t_2 return tmp
function code(u, v, t1) t_1 = Float64(Float64(t1 + u) * Float64(t1 + u)) t_2 = Float64(-Float64(v / t1)) tmp = 0.0 if (t1 <= -5e+154) tmp = t_2; elseif (t1 <= -5.3e-182) tmp = Float64(v * Float64(Float64(-t1) / t_1)); elseif (t1 <= 1.7e-246) tmp = Float64(v * Float64(Float64(t1 / Float64(-u)) / Float64(t1 + u))); elseif (t1 <= 1.95e+149) tmp = Float64(t1 * Float64(v * Float64(-1.0 / t_1))); else tmp = t_2; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (t1 + u) * (t1 + u); t_2 = -(v / t1); tmp = 0.0; if (t1 <= -5e+154) tmp = t_2; elseif (t1 <= -5.3e-182) tmp = v * (-t1 / t_1); elseif (t1 <= 1.7e-246) tmp = v * ((t1 / -u) / (t1 + u)); elseif (t1 <= 1.95e+149) tmp = t1 * (v * (-1.0 / t_1)); else tmp = t_2; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(v / t1), $MachinePrecision])}, If[LessEqual[t1, -5e+154], t$95$2, If[LessEqual[t1, -5.3e-182], N[(v * N[((-t1) / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.7e-246], N[(v * N[(N[(t1 / (-u)), $MachinePrecision] / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.95e+149], N[(t1 * N[(v * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t1 + u\right) \cdot \left(t1 + u\right)\\
t_2 := -\frac{v}{t1}\\
\mathbf{if}\;t1 \leq -5 \cdot 10^{+154}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq -5.3 \cdot 10^{-182}:\\
\;\;\;\;v \cdot \frac{-t1}{t\_1}\\
\mathbf{elif}\;t1 \leq 1.7 \cdot 10^{-246}:\\
\;\;\;\;v \cdot \frac{\frac{t1}{-u}}{t1 + u}\\
\mathbf{elif}\;t1 \leq 1.95 \cdot 10^{+149}:\\
\;\;\;\;t1 \cdot \left(v \cdot \frac{-1}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t1 < -5.00000000000000004e154 or 1.95e149 < t1 Initial program 30.4%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6493.3
Applied rewrites93.3%
if -5.00000000000000004e154 < t1 < -5.30000000000000005e-182Initial program 82.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6488.4
Applied rewrites88.4%
if -5.30000000000000005e-182 < t1 < 1.7000000000000001e-246Initial program 72.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.7
Applied rewrites76.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lift-neg.f64N/A
distribute-neg-fracN/A
lift-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
distribute-neg-frac2N/A
lift-neg.f64N/A
lower-/.f6495.1
lift-neg.f64N/A
lift-+.f64N/A
distribute-neg-inN/A
lift-neg.f64N/A
unsub-negN/A
lower--.f6495.1
Applied rewrites95.1%
Taylor expanded in t1 around 0
mul-1-negN/A
lower-neg.f6491.0
Applied rewrites91.0%
if 1.7000000000000001e-246 < t1 < 1.95e149Initial program 87.7%
lift-/.f64N/A
frac-2negN/A
div-invN/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f64N/A
neg-mul-1N/A
associate-/r*N/A
metadata-evalN/A
lower-/.f6491.1
Applied rewrites91.1%
Final simplification91.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (/ v t1))) (t_2 (* v (/ (- t1) (* (+ t1 u) (+ t1 u))))))
(if (<= t1 -5e+154)
t_1
(if (<= t1 -2.4e-231)
t_2
(if (<= t1 2.1e-125)
(/ (* t1 (/ v u)) (- u))
(if (<= t1 5.7e+149) t_2 t_1))))))
double code(double u, double v, double t1) {
double t_1 = -(v / t1);
double t_2 = v * (-t1 / ((t1 + u) * (t1 + u)));
double tmp;
if (t1 <= -5e+154) {
tmp = t_1;
} else if (t1 <= -2.4e-231) {
tmp = t_2;
} else if (t1 <= 2.1e-125) {
tmp = (t1 * (v / u)) / -u;
} else if (t1 <= 5.7e+149) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = -(v / t1)
t_2 = v * (-t1 / ((t1 + u) * (t1 + u)))
if (t1 <= (-5d+154)) then
tmp = t_1
else if (t1 <= (-2.4d-231)) then
tmp = t_2
else if (t1 <= 2.1d-125) then
tmp = (t1 * (v / u)) / -u
else if (t1 <= 5.7d+149) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -(v / t1);
double t_2 = v * (-t1 / ((t1 + u) * (t1 + u)));
double tmp;
if (t1 <= -5e+154) {
tmp = t_1;
} else if (t1 <= -2.4e-231) {
tmp = t_2;
} else if (t1 <= 2.1e-125) {
tmp = (t1 * (v / u)) / -u;
} else if (t1 <= 5.7e+149) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -(v / t1) t_2 = v * (-t1 / ((t1 + u) * (t1 + u))) tmp = 0 if t1 <= -5e+154: tmp = t_1 elif t1 <= -2.4e-231: tmp = t_2 elif t1 <= 2.1e-125: tmp = (t1 * (v / u)) / -u elif t1 <= 5.7e+149: tmp = t_2 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(-Float64(v / t1)) t_2 = Float64(v * Float64(Float64(-t1) / Float64(Float64(t1 + u) * Float64(t1 + u)))) tmp = 0.0 if (t1 <= -5e+154) tmp = t_1; elseif (t1 <= -2.4e-231) tmp = t_2; elseif (t1 <= 2.1e-125) tmp = Float64(Float64(t1 * Float64(v / u)) / Float64(-u)); elseif (t1 <= 5.7e+149) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -(v / t1); t_2 = v * (-t1 / ((t1 + u) * (t1 + u))); tmp = 0.0; if (t1 <= -5e+154) tmp = t_1; elseif (t1 <= -2.4e-231) tmp = t_2; elseif (t1 <= 2.1e-125) tmp = (t1 * (v / u)) / -u; elseif (t1 <= 5.7e+149) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = (-N[(v / t1), $MachinePrecision])}, Block[{t$95$2 = N[(v * N[((-t1) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -5e+154], t$95$1, If[LessEqual[t1, -2.4e-231], t$95$2, If[LessEqual[t1, 2.1e-125], N[(N[(t1 * N[(v / u), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision], If[LessEqual[t1, 5.7e+149], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -\frac{v}{t1}\\
t_2 := v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -5 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq -2.4 \cdot 10^{-231}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq 2.1 \cdot 10^{-125}:\\
\;\;\;\;\frac{t1 \cdot \frac{v}{u}}{-u}\\
\mathbf{elif}\;t1 \leq 5.7 \cdot 10^{+149}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -5.00000000000000004e154 or 5.69999999999999965e149 < t1 Initial program 30.4%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6493.3
Applied rewrites93.3%
if -5.00000000000000004e154 < t1 < -2.39999999999999992e-231 or 2.1e-125 < t1 < 5.69999999999999965e149Initial program 85.8%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6491.2
Applied rewrites91.2%
if -2.39999999999999992e-231 < t1 < 2.1e-125Initial program 72.9%
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.f6488.4
Applied rewrites88.4%
Taylor expanded in t1 around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6483.4
Applied rewrites83.4%
Taylor expanded in t1 around 0
mul-1-negN/A
lower-neg.f6485.6
Applied rewrites85.6%
Final simplification90.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))))
(if (<= t1 -2e+67)
t_1
(if (<= t1 4.8e-247)
(* v (/ (- t1) (* u u)))
(if (<= t1 9.5e-6) (* (- t1) (/ v (* u u))) t_1)))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -2e+67) {
tmp = t_1;
} else if (t1 <= 4.8e-247) {
tmp = v * (-t1 / (u * u));
} else if (t1 <= 9.5e-6) {
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 / (t1 + u)
if (t1 <= (-2d+67)) then
tmp = t_1
else if (t1 <= 4.8d-247) then
tmp = v * (-t1 / (u * u))
else if (t1 <= 9.5d-6) 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 / (t1 + u);
double tmp;
if (t1 <= -2e+67) {
tmp = t_1;
} else if (t1 <= 4.8e-247) {
tmp = v * (-t1 / (u * u));
} else if (t1 <= 9.5e-6) {
tmp = -t1 * (v / (u * u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -2e+67: tmp = t_1 elif t1 <= 4.8e-247: tmp = v * (-t1 / (u * u)) elif t1 <= 9.5e-6: tmp = -t1 * (v / (u * u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -2e+67) tmp = t_1; elseif (t1 <= 4.8e-247) tmp = Float64(v * Float64(Float64(-t1) / Float64(u * u))); elseif (t1 <= 9.5e-6) 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 = -v / (t1 + u); tmp = 0.0; if (t1 <= -2e+67) tmp = t_1; elseif (t1 <= 4.8e-247) tmp = v * (-t1 / (u * u)); elseif (t1 <= 9.5e-6) 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[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2e+67], t$95$1, If[LessEqual[t1, 4.8e-247], N[(v * N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 9.5e-6], N[((-t1) * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -2 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 4.8 \cdot 10^{-247}:\\
\;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\
\mathbf{elif}\;t1 \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.99999999999999997e67 or 9.5000000000000005e-6 < t1 Initial program 53.0%
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.9
Applied rewrites99.9%
Taylor expanded in t1 around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6422.1
Applied rewrites22.1%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
distribute-frac-negN/A
lower-/.f64N/A
lower-neg.f6422.1
Applied rewrites18.0%
Taylor expanded in t1 around inf
mul-1-negN/A
lower-neg.f6488.6
Applied rewrites88.6%
if -1.99999999999999997e67 < t1 < 4.80000000000000022e-247Initial program 80.1%
Taylor expanded in t1 around 0
unpow2N/A
lower-*.f6470.6
Applied rewrites70.6%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6473.1
Applied rewrites73.1%
if 4.80000000000000022e-247 < t1 < 9.5000000000000005e-6Initial program 84.3%
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.f6473.7
Applied rewrites73.7%
Final simplification80.6%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (/ v t1))))
(if (<= t1 -5e+154)
t_1
(if (<= t1 5.7e+149) (* v (/ (- t1) (* (+ t1 u) (+ t1 u)))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -(v / t1);
double tmp;
if (t1 <= -5e+154) {
tmp = t_1;
} else if (t1 <= 5.7e+149) {
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 / t1)
if (t1 <= (-5d+154)) then
tmp = t_1
else if (t1 <= 5.7d+149) 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 / t1);
double tmp;
if (t1 <= -5e+154) {
tmp = t_1;
} else if (t1 <= 5.7e+149) {
tmp = v * (-t1 / ((t1 + u) * (t1 + u)));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -(v / t1) tmp = 0 if t1 <= -5e+154: tmp = t_1 elif t1 <= 5.7e+149: tmp = v * (-t1 / ((t1 + u) * (t1 + u))) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(-Float64(v / t1)) tmp = 0.0 if (t1 <= -5e+154) tmp = t_1; elseif (t1 <= 5.7e+149) 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 / t1); tmp = 0.0; if (t1 <= -5e+154) tmp = t_1; elseif (t1 <= 5.7e+149) 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 / t1), $MachinePrecision])}, If[LessEqual[t1, -5e+154], t$95$1, If[LessEqual[t1, 5.7e+149], 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}{t1}\\
\mathbf{if}\;t1 \leq -5 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 5.7 \cdot 10^{+149}:\\
\;\;\;\;v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -5.00000000000000004e154 or 5.69999999999999965e149 < t1 Initial program 30.4%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6493.3
Applied rewrites93.3%
if -5.00000000000000004e154 < t1 < 5.69999999999999965e149Initial program 82.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.8
Applied rewrites84.8%
Final simplification87.1%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (- v) (+ t1 u)))) (if (<= t1 -2e+67) t_1 (if (<= t1 9.5e-6) (/ (* t1 (- v)) (* u u)) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -2e+67) {
tmp = t_1;
} else if (t1 <= 9.5e-6) {
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 / (t1 + u)
if (t1 <= (-2d+67)) then
tmp = t_1
else if (t1 <= 9.5d-6) 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 / (t1 + u);
double tmp;
if (t1 <= -2e+67) {
tmp = t_1;
} else if (t1 <= 9.5e-6) {
tmp = (t1 * -v) / (u * u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -2e+67: tmp = t_1 elif t1 <= 9.5e-6: tmp = (t1 * -v) / (u * u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -2e+67) tmp = t_1; elseif (t1 <= 9.5e-6) 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 = -v / (t1 + u); tmp = 0.0; if (t1 <= -2e+67) tmp = t_1; elseif (t1 <= 9.5e-6) 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[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2e+67], t$95$1, If[LessEqual[t1, 9.5e-6], N[(N[(t1 * (-v)), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -2 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;\frac{t1 \cdot \left(-v\right)}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.99999999999999997e67 or 9.5000000000000005e-6 < t1 Initial program 53.0%
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.9
Applied rewrites99.9%
Taylor expanded in t1 around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6422.1
Applied rewrites22.1%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
distribute-frac-negN/A
lower-/.f64N/A
lower-neg.f6422.1
Applied rewrites18.0%
Taylor expanded in t1 around inf
mul-1-negN/A
lower-neg.f6488.6
Applied rewrites88.6%
if -1.99999999999999997e67 < t1 < 9.5000000000000005e-6Initial program 81.6%
Taylor expanded in t1 around 0
unpow2N/A
lower-*.f6471.1
Applied rewrites71.1%
Final simplification79.5%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (- v) (+ t1 u)))) (if (<= t1 -2e+67) t_1 (if (<= t1 9.5e-6) (* (- t1) (/ v (* u u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -2e+67) {
tmp = t_1;
} else if (t1 <= 9.5e-6) {
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 / (t1 + u)
if (t1 <= (-2d+67)) then
tmp = t_1
else if (t1 <= 9.5d-6) 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 / (t1 + u);
double tmp;
if (t1 <= -2e+67) {
tmp = t_1;
} else if (t1 <= 9.5e-6) {
tmp = -t1 * (v / (u * u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -2e+67: tmp = t_1 elif t1 <= 9.5e-6: tmp = -t1 * (v / (u * u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -2e+67) tmp = t_1; elseif (t1 <= 9.5e-6) 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 = -v / (t1 + u); tmp = 0.0; if (t1 <= -2e+67) tmp = t_1; elseif (t1 <= 9.5e-6) 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[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2e+67], t$95$1, If[LessEqual[t1, 9.5e-6], N[((-t1) * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -2 \cdot 10^{+67}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 9.5 \cdot 10^{-6}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.99999999999999997e67 or 9.5000000000000005e-6 < t1 Initial program 53.0%
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.9
Applied rewrites99.9%
Taylor expanded in t1 around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6422.1
Applied rewrites22.1%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
distribute-frac-negN/A
lower-/.f64N/A
lower-neg.f6422.1
Applied rewrites18.0%
Taylor expanded in t1 around inf
mul-1-negN/A
lower-neg.f6488.6
Applied rewrites88.6%
if -1.99999999999999997e67 < t1 < 9.5000000000000005e-6Initial program 81.6%
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.f6469.3
Applied rewrites69.3%
Final simplification78.5%
(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 68.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%
Final simplification96.7%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* v (/ t1 (* u u))))) (if (<= u -2.4e+157) t_1 (if (<= u 9e+201) (/ (- v) (+ t1 u)) t_1))))
double code(double u, double v, double t1) {
double t_1 = v * (t1 / (u * u));
double tmp;
if (u <= -2.4e+157) {
tmp = t_1;
} else if (u <= 9e+201) {
tmp = -v / (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 * (t1 / (u * u))
if (u <= (-2.4d+157)) then
tmp = t_1
else if (u <= 9d+201) then
tmp = -v / (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 * (t1 / (u * u));
double tmp;
if (u <= -2.4e+157) {
tmp = t_1;
} else if (u <= 9e+201) {
tmp = -v / (t1 + u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = v * (t1 / (u * u)) tmp = 0 if u <= -2.4e+157: tmp = t_1 elif u <= 9e+201: tmp = -v / (t1 + u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(v * Float64(t1 / Float64(u * u))) tmp = 0.0 if (u <= -2.4e+157) tmp = t_1; elseif (u <= 9e+201) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v * (t1 / (u * u)); tmp = 0.0; if (u <= -2.4e+157) tmp = t_1; elseif (u <= 9e+201) tmp = -v / (t1 + u); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v * N[(t1 / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -2.4e+157], t$95$1, If[LessEqual[u, 9e+201], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := v \cdot \frac{t1}{u \cdot u}\\
\mathbf{if}\;u \leq -2.4 \cdot 10^{+157}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 9 \cdot 10^{+201}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -2.4e157 or 9.0000000000000002e201 < u Initial program 72.0%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6472.2
Applied rewrites72.2%
Taylor expanded in t1 around 0
unpow2N/A
lower-*.f6472.2
Applied rewrites72.2%
Applied rewrites72.2%
if -2.4e157 < u < 9.0000000000000002e201Initial program 67.1%
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.f6497.2
Applied rewrites97.2%
Taylor expanded in t1 around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6440.4
Applied rewrites40.4%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
distribute-frac-negN/A
lower-/.f64N/A
lower-neg.f6440.4
Applied rewrites38.2%
Taylor expanded in t1 around inf
mul-1-negN/A
lower-neg.f6464.8
Applied rewrites64.8%
Final simplification66.2%
(FPCore (u v t1) :precision binary64 (/ (- v) (+ t1 u)))
double code(double u, double v, double t1) {
return -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 = -v / (t1 + u)
end function
public static double code(double u, double v, double t1) {
return -v / (t1 + u);
}
def code(u, v, t1): return -v / (t1 + u)
function code(u, v, t1) return Float64(Float64(-v) / Float64(t1 + u)) end
function tmp = code(u, v, t1) tmp = -v / (t1 + u); end
code[u_, v_, t1_] := N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{t1 + u}
\end{array}
Initial program 68.0%
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.f6497.6
Applied rewrites97.6%
Taylor expanded in t1 around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f6451.3
Applied rewrites51.3%
lift-/.f64N/A
lift-neg.f64N/A
distribute-frac-neg2N/A
distribute-frac-negN/A
lower-/.f64N/A
lower-neg.f6451.3
Applied rewrites48.4%
Taylor expanded in t1 around inf
mul-1-negN/A
lower-neg.f6458.9
Applied rewrites58.9%
(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 68.0%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.3
Applied rewrites53.3%
Final simplification53.3%
herbie shell --seed 2024232
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))