
(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 (/ (* (/ 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 76.0%
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.f6499.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.0
Applied rewrites99.0%
Final simplification99.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) t1)) (t_2 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
(if (<= t1 -6e+116)
t_1
(if (<= t1 -3.6e-112)
t_2
(if (<= t1 9.2e-222)
(* (/ (- v) u) (/ t1 u))
(if (<= t1 2.05e+102) t_2 t_1))))))
double code(double u, double v, double t1) {
double t_1 = -v / t1;
double t_2 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -6e+116) {
tmp = t_1;
} else if (t1 <= -3.6e-112) {
tmp = t_2;
} else if (t1 <= 9.2e-222) {
tmp = (-v / u) * (t1 / u);
} else if (t1 <= 2.05e+102) {
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 = (-t1 * v) / ((t1 + u) * (t1 + u))
if (t1 <= (-6d+116)) then
tmp = t_1
else if (t1 <= (-3.6d-112)) then
tmp = t_2
else if (t1 <= 9.2d-222) then
tmp = (-v / u) * (t1 / u)
else if (t1 <= 2.05d+102) 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 = (-t1 * v) / ((t1 + u) * (t1 + u));
double tmp;
if (t1 <= -6e+116) {
tmp = t_1;
} else if (t1 <= -3.6e-112) {
tmp = t_2;
} else if (t1 <= 9.2e-222) {
tmp = (-v / u) * (t1 / u);
} else if (t1 <= 2.05e+102) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / t1 t_2 = (-t1 * v) / ((t1 + u) * (t1 + u)) tmp = 0 if t1 <= -6e+116: tmp = t_1 elif t1 <= -3.6e-112: tmp = t_2 elif t1 <= 9.2e-222: tmp = (-v / u) * (t1 / u) elif t1 <= 2.05e+102: tmp = t_2 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / t1) t_2 = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) tmp = 0.0 if (t1 <= -6e+116) tmp = t_1; elseif (t1 <= -3.6e-112) tmp = t_2; elseif (t1 <= 9.2e-222) tmp = Float64(Float64(Float64(-v) / u) * Float64(t1 / u)); elseif (t1 <= 2.05e+102) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / t1; t_2 = (-t1 * v) / ((t1 + u) * (t1 + u)); tmp = 0.0; if (t1 <= -6e+116) tmp = t_1; elseif (t1 <= -3.6e-112) tmp = t_2; elseif (t1 <= 9.2e-222) tmp = (-v / u) * (t1 / u); elseif (t1 <= 2.05e+102) 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[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -6e+116], t$95$1, If[LessEqual[t1, -3.6e-112], t$95$2, If[LessEqual[t1, 9.2e-222], N[(N[((-v) / u), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.05e+102], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1}\\
t_2 := \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -6 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq -3.6 \cdot 10^{-112}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq 9.2 \cdot 10^{-222}:\\
\;\;\;\;\frac{-v}{u} \cdot \frac{t1}{u}\\
\mathbf{elif}\;t1 \leq 2.05 \cdot 10^{+102}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -5.9999999999999997e116 or 2.05e102 < t1 Initial program 45.0%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6492.9
Applied rewrites92.9%
if -5.9999999999999997e116 < t1 < -3.6000000000000001e-112 or 9.2000000000000005e-222 < t1 < 2.05e102Initial program 95.4%
if -3.6000000000000001e-112 < t1 < 9.2000000000000005e-222Initial program 78.8%
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-/.f6497.3
Applied rewrites97.3%
Final simplification95.0%
(FPCore (u v t1) :precision binary64 (if (<= (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))) -2e-16) (/ (- v) t1) (/ (- v) (+ t1 u))))
double code(double u, double v, double t1) {
double tmp;
if (((-t1 * v) / ((t1 + u) * (t1 + u))) <= -2e-16) {
tmp = -v / t1;
} else {
tmp = -v / (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 (((-t1 * v) / ((t1 + u) * (t1 + u))) <= (-2d-16)) then
tmp = -v / t1
else
tmp = -v / (t1 + u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (((-t1 * v) / ((t1 + u) * (t1 + u))) <= -2e-16) {
tmp = -v / t1;
} else {
tmp = -v / (t1 + u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if ((-t1 * v) / ((t1 + u) * (t1 + u))) <= -2e-16: tmp = -v / t1 else: tmp = -v / (t1 + u) return tmp
function code(u, v, t1) tmp = 0.0 if (Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) <= -2e-16) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(-v) / Float64(t1 + u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (((-t1 * v) / ((t1 + u) * (t1 + u))) <= -2e-16) tmp = -v / t1; else tmp = -v / (t1 + u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -2e-16], N[((-v) / t1), $MachinePrecision], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \leq -2 \cdot 10^{-16}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\end{array}
\end{array}
if (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) < -2e-16Initial program 90.5%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6472.5
Applied rewrites72.5%
if -2e-16 < (/.f64 (*.f64 (neg.f64 t1) v) (*.f64 (+.f64 t1 u) (+.f64 t1 u))) Initial program 74.0%
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.f6498.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.9
Applied rewrites98.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6498.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.8
Applied rewrites98.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
neg-mul-1N/A
lift-neg.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites97.6%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6459.3
Applied rewrites59.3%
Final simplification60.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))))
(if (<= t1 -8.8e-72)
t_1
(if (<= t1 1.26e-51) (* (/ (- v) u) (/ t1 u)) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -8.8e-72) {
tmp = t_1;
} else if (t1 <= 1.26e-51) {
tmp = (-v / 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 + u)
if (t1 <= (-8.8d-72)) then
tmp = t_1
else if (t1 <= 1.26d-51) then
tmp = (-v / 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 + u);
double tmp;
if (t1 <= -8.8e-72) {
tmp = t_1;
} else if (t1 <= 1.26e-51) {
tmp = (-v / u) * (t1 / u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -8.8e-72: tmp = t_1 elif t1 <= 1.26e-51: tmp = (-v / u) * (t1 / 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 <= -8.8e-72) tmp = t_1; elseif (t1 <= 1.26e-51) tmp = Float64(Float64(Float64(-v) / u) * Float64(t1 / 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 <= -8.8e-72) tmp = t_1; elseif (t1 <= 1.26e-51) tmp = (-v / u) * (t1 / 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, -8.8e-72], t$95$1, If[LessEqual[t1, 1.26e-51], N[(N[((-v) / u), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -8.8 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.26 \cdot 10^{-51}:\\
\;\;\;\;\frac{-v}{u} \cdot \frac{t1}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -8.8000000000000001e-72 or 1.2600000000000001e-51 < t1 Initial program 68.4%
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.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
neg-mul-1N/A
lift-neg.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6483.7
Applied rewrites83.7%
if -8.8000000000000001e-72 < t1 < 1.2600000000000001e-51Initial program 86.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-/.f6491.2
Applied rewrites91.2%
Final simplification86.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))))
(if (<= t1 -8.8e-72)
t_1
(if (<= t1 1.26e-51) (* (/ (- v) (* u u)) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -8.8e-72) {
tmp = t_1;
} else if (t1 <= 1.26e-51) {
tmp = (-v / (u * u)) * 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 / (t1 + u)
if (t1 <= (-8.8d-72)) then
tmp = t_1
else if (t1 <= 1.26d-51) then
tmp = (-v / (u * u)) * 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 / (t1 + u);
double tmp;
if (t1 <= -8.8e-72) {
tmp = t_1;
} else if (t1 <= 1.26e-51) {
tmp = (-v / (u * u)) * t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -8.8e-72: tmp = t_1 elif t1 <= 1.26e-51: tmp = (-v / (u * u)) * t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -8.8e-72) tmp = t_1; elseif (t1 <= 1.26e-51) tmp = Float64(Float64(Float64(-v) / Float64(u * u)) * t1); 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 <= -8.8e-72) tmp = t_1; elseif (t1 <= 1.26e-51) tmp = (-v / (u * u)) * t1; 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, -8.8e-72], t$95$1, If[LessEqual[t1, 1.26e-51], N[(N[((-v) / N[(u * u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -8.8 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.26 \cdot 10^{-51}:\\
\;\;\;\;\frac{-v}{u \cdot u} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -8.8000000000000001e-72 or 1.2600000000000001e-51 < t1 Initial program 68.4%
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.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
neg-mul-1N/A
lift-neg.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6483.7
Applied rewrites83.7%
if -8.8000000000000001e-72 < t1 < 1.2600000000000001e-51Initial program 86.5%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6481.7
Applied rewrites81.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6484.8
Applied rewrites84.8%
Final simplification84.2%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))))
(if (<= t1 -8.8e-72)
t_1
(if (<= t1 1.26e-51) (* (/ (- t1) (* u u)) v) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -8.8e-72) {
tmp = t_1;
} else if (t1 <= 1.26e-51) {
tmp = (-t1 / (u * u)) * v;
} 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 <= (-8.8d-72)) then
tmp = t_1
else if (t1 <= 1.26d-51) then
tmp = (-t1 / (u * u)) * v
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 <= -8.8e-72) {
tmp = t_1;
} else if (t1 <= 1.26e-51) {
tmp = (-t1 / (u * u)) * v;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -8.8e-72: tmp = t_1 elif t1 <= 1.26e-51: tmp = (-t1 / (u * u)) * v else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -8.8e-72) tmp = t_1; elseif (t1 <= 1.26e-51) tmp = Float64(Float64(Float64(-t1) / Float64(u * u)) * v); 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 <= -8.8e-72) tmp = t_1; elseif (t1 <= 1.26e-51) tmp = (-t1 / (u * u)) * v; 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, -8.8e-72], t$95$1, If[LessEqual[t1, 1.26e-51], N[(N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -8.8 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.26 \cdot 10^{-51}:\\
\;\;\;\;\frac{-t1}{u \cdot u} \cdot v\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -8.8000000000000001e-72 or 1.2600000000000001e-51 < t1 Initial program 68.4%
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.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.7
Applied rewrites99.7%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
neg-mul-1N/A
lift-neg.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6483.7
Applied rewrites83.7%
if -8.8000000000000001e-72 < t1 < 1.2600000000000001e-51Initial program 86.5%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6481.7
Applied rewrites81.7%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6483.0
Applied rewrites83.0%
Final simplification83.4%
(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 76.0%
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.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
Final simplification97.9%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (* t1 v) (* u u)))) (if (<= u -7.4e+76) t_1 (if (<= u 5.3e+129) (/ (- v) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = (t1 * v) / (u * u);
double tmp;
if (u <= -7.4e+76) {
tmp = t_1;
} else if (u <= 5.3e+129) {
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 = (t1 * v) / (u * u)
if (u <= (-7.4d+76)) then
tmp = t_1
else if (u <= 5.3d+129) 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 = (t1 * v) / (u * u);
double tmp;
if (u <= -7.4e+76) {
tmp = t_1;
} else if (u <= 5.3e+129) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (t1 * v) / (u * u) tmp = 0 if u <= -7.4e+76: tmp = t_1 elif u <= 5.3e+129: tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(t1 * v) / Float64(u * u)) tmp = 0.0 if (u <= -7.4e+76) tmp = t_1; elseif (u <= 5.3e+129) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (t1 * v) / (u * u); tmp = 0.0; if (u <= -7.4e+76) tmp = t_1; elseif (u <= 5.3e+129) tmp = -v / t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(t1 * v), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -7.4e+76], t$95$1, If[LessEqual[u, 5.3e+129], N[((-v) / t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t1 \cdot v}{u \cdot u}\\
\mathbf{if}\;u \leq -7.4 \cdot 10^{+76}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 5.3 \cdot 10^{+129}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -7.3999999999999999e76 or 5.2999999999999999e129 < u Initial program 81.3%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6479.1
Applied rewrites79.1%
lift-/.f64N/A
frac-2negN/A
div-invN/A
lower-*.f64N/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
remove-double-negN/A
lower-*.f64N/A
frac-2negN/A
metadata-evalN/A
remove-double-negN/A
lower-/.f6479.1
Applied rewrites79.1%
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
neg-mul-1N/A
Applied rewrites72.6%
if -7.3999999999999999e76 < u < 5.2999999999999999e129Initial program 73.3%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6467.7
Applied rewrites67.7%
Final simplification69.4%
(FPCore (u v t1) :precision binary64 (/ v (* (- u t1) (/ (- t1 u) t1))))
double code(double u, double v, double t1) {
return v / ((u - t1) * ((t1 - u) / t1));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = v / ((u - t1) * ((t1 - u) / t1))
end function
public static double code(double u, double v, double t1) {
return v / ((u - t1) * ((t1 - u) / t1));
}
def code(u, v, t1): return v / ((u - t1) * ((t1 - u) / t1))
function code(u, v, t1) return Float64(v / Float64(Float64(u - t1) * Float64(Float64(t1 - u) / t1))) end
function tmp = code(u, v, t1) tmp = v / ((u - t1) * ((t1 - u) / t1)); end
code[u_, v_, t1_] := N[(v / N[(N[(u - t1), $MachinePrecision] * N[(N[(t1 - u), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{\left(u - t1\right) \cdot \frac{t1 - u}{t1}}
\end{array}
Initial program 76.0%
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.f6499.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.0
Applied rewrites99.0%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lower-*.f64N/A
metadata-evalN/A
lift-neg.f64N/A
frac-2negN/A
lower-/.f6498.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.8
Applied rewrites98.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
neg-mul-1N/A
lift-neg.f64N/A
associate-*l/N/A
lift-/.f64N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites97.9%
Applied rewrites94.9%
Final simplification94.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 76.0%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6452.2
Applied rewrites52.2%
(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 / t1) end
function tmp = code(u, v, t1) tmp = v / t1; end
code[u_, v_, t1_] := N[(v / t1), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{t1}
\end{array}
Initial program 76.0%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6452.2
Applied rewrites52.2%
Applied rewrites51.9%
Applied rewrites11.5%
herbie shell --seed 2024304
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))