
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
(FPCore (u v t1) :precision binary64 (/ (* (/ 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.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.f6498.1
Applied rewrites98.1%
Final simplification98.1%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (- t1) u)))
(if (<= t1 -1.08e+159)
(/ v (- t1))
(if (<= t1 2e+128)
(* v (/ t1 (* (+ t1 u) t_1)))
(/ (* t1 (/ v t1)) t_1)))))
double code(double u, double v, double t1) {
double t_1 = -t1 - u;
double tmp;
if (t1 <= -1.08e+159) {
tmp = v / -t1;
} else if (t1 <= 2e+128) {
tmp = v * (t1 / ((t1 + u) * t_1));
} else {
tmp = (t1 * (v / t1)) / 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 - u
if (t1 <= (-1.08d+159)) then
tmp = v / -t1
else if (t1 <= 2d+128) then
tmp = v * (t1 / ((t1 + u) * t_1))
else
tmp = (t1 * (v / t1)) / t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -t1 - u;
double tmp;
if (t1 <= -1.08e+159) {
tmp = v / -t1;
} else if (t1 <= 2e+128) {
tmp = v * (t1 / ((t1 + u) * t_1));
} else {
tmp = (t1 * (v / t1)) / t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -t1 - u tmp = 0 if t1 <= -1.08e+159: tmp = v / -t1 elif t1 <= 2e+128: tmp = v * (t1 / ((t1 + u) * t_1)) else: tmp = (t1 * (v / t1)) / t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-t1) - u) tmp = 0.0 if (t1 <= -1.08e+159) tmp = Float64(v / Float64(-t1)); elseif (t1 <= 2e+128) tmp = Float64(v * Float64(t1 / Float64(Float64(t1 + u) * t_1))); else tmp = Float64(Float64(t1 * Float64(v / t1)) / t_1); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -t1 - u; tmp = 0.0; if (t1 <= -1.08e+159) tmp = v / -t1; elseif (t1 <= 2e+128) tmp = v * (t1 / ((t1 + u) * t_1)); else tmp = (t1 * (v / t1)) / t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-t1) - u), $MachinePrecision]}, If[LessEqual[t1, -1.08e+159], N[(v / (-t1)), $MachinePrecision], If[LessEqual[t1, 2e+128], N[(v * N[(t1 / N[(N[(t1 + u), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t1 * N[(v / t1), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t1\right) - u\\
\mathbf{if}\;t1 \leq -1.08 \cdot 10^{+159}:\\
\;\;\;\;\frac{v}{-t1}\\
\mathbf{elif}\;t1 \leq 2 \cdot 10^{+128}:\\
\;\;\;\;v \cdot \frac{t1}{\left(t1 + u\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1 \cdot \frac{v}{t1}}{t\_1}\\
\end{array}
\end{array}
if t1 < -1.07999999999999991e159Initial program 47.1%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6495.1
Applied rewrites95.1%
if -1.07999999999999991e159 < t1 < 2.0000000000000002e128Initial program 80.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6487.1
Applied rewrites87.1%
if 2.0000000000000002e128 < t1 Initial program 45.5%
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
lower-neg.f6499.9
Applied rewrites99.9%
Taylor expanded in t1 around inf
lower-/.f6492.5
Applied rewrites92.5%
Final simplification89.4%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (- t1))))
(if (<= t1 -1.08e+159)
t_1
(if (<= t1 2e+128)
(* v (/ t1 (* (+ t1 u) (- (- t1) u))))
(* (/ t1 (+ t1 u)) t_1)))))
double code(double u, double v, double t1) {
double t_1 = v / -t1;
double tmp;
if (t1 <= -1.08e+159) {
tmp = t_1;
} else if (t1 <= 2e+128) {
tmp = v * (t1 / ((t1 + u) * (-t1 - u)));
} else {
tmp = (t1 / (t1 + u)) * 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 <= (-1.08d+159)) then
tmp = t_1
else if (t1 <= 2d+128) then
tmp = v * (t1 / ((t1 + u) * (-t1 - u)))
else
tmp = (t1 / (t1 + u)) * 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 <= -1.08e+159) {
tmp = t_1;
} else if (t1 <= 2e+128) {
tmp = v * (t1 / ((t1 + u) * (-t1 - u)));
} else {
tmp = (t1 / (t1 + u)) * t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = v / -t1 tmp = 0 if t1 <= -1.08e+159: tmp = t_1 elif t1 <= 2e+128: tmp = v * (t1 / ((t1 + u) * (-t1 - u))) else: tmp = (t1 / (t1 + u)) * t_1 return tmp
function code(u, v, t1) t_1 = Float64(v / Float64(-t1)) tmp = 0.0 if (t1 <= -1.08e+159) tmp = t_1; elseif (t1 <= 2e+128) tmp = Float64(v * Float64(t1 / Float64(Float64(t1 + u) * Float64(Float64(-t1) - u)))); else tmp = Float64(Float64(t1 / Float64(t1 + u)) * t_1); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v / -t1; tmp = 0.0; if (t1 <= -1.08e+159) tmp = t_1; elseif (t1 <= 2e+128) tmp = v * (t1 / ((t1 + u) * (-t1 - u))); else tmp = (t1 / (t1 + u)) * t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / (-t1)), $MachinePrecision]}, If[LessEqual[t1, -1.08e+159], t$95$1, If[LessEqual[t1, 2e+128], N[(v * N[(t1 / N[(N[(t1 + u), $MachinePrecision] * N[((-t1) - u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{-t1}\\
\mathbf{if}\;t1 \leq -1.08 \cdot 10^{+159}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 2 \cdot 10^{+128}:\\
\;\;\;\;v \cdot \frac{t1}{\left(t1 + u\right) \cdot \left(\left(-t1\right) - u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{t1 + u} \cdot t\_1\\
\end{array}
\end{array}
if t1 < -1.07999999999999991e159Initial program 47.1%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6495.1
Applied rewrites95.1%
if -1.07999999999999991e159 < t1 < 2.0000000000000002e128Initial program 80.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6487.1
Applied rewrites87.1%
if 2.0000000000000002e128 < t1 Initial program 45.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.f6492.5
Applied rewrites92.5%
Final simplification89.4%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (- t1) u)))
(if (<= t1 -1.08e+159)
(/ v (- t1))
(if (<= t1 2e+128) (* v (/ t1 (* (+ t1 u) t_1))) (* (/ v t_1) 1.0)))))
double code(double u, double v, double t1) {
double t_1 = -t1 - u;
double tmp;
if (t1 <= -1.08e+159) {
tmp = v / -t1;
} else if (t1 <= 2e+128) {
tmp = v * (t1 / ((t1 + u) * t_1));
} else {
tmp = (v / t_1) * 1.0;
}
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 - u
if (t1 <= (-1.08d+159)) then
tmp = v / -t1
else if (t1 <= 2d+128) then
tmp = v * (t1 / ((t1 + u) * t_1))
else
tmp = (v / t_1) * 1.0d0
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -t1 - u;
double tmp;
if (t1 <= -1.08e+159) {
tmp = v / -t1;
} else if (t1 <= 2e+128) {
tmp = v * (t1 / ((t1 + u) * t_1));
} else {
tmp = (v / t_1) * 1.0;
}
return tmp;
}
def code(u, v, t1): t_1 = -t1 - u tmp = 0 if t1 <= -1.08e+159: tmp = v / -t1 elif t1 <= 2e+128: tmp = v * (t1 / ((t1 + u) * t_1)) else: tmp = (v / t_1) * 1.0 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-t1) - u) tmp = 0.0 if (t1 <= -1.08e+159) tmp = Float64(v / Float64(-t1)); elseif (t1 <= 2e+128) tmp = Float64(v * Float64(t1 / Float64(Float64(t1 + u) * t_1))); else tmp = Float64(Float64(v / t_1) * 1.0); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -t1 - u; tmp = 0.0; if (t1 <= -1.08e+159) tmp = v / -t1; elseif (t1 <= 2e+128) tmp = v * (t1 / ((t1 + u) * t_1)); else tmp = (v / t_1) * 1.0; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-t1) - u), $MachinePrecision]}, If[LessEqual[t1, -1.08e+159], N[(v / (-t1)), $MachinePrecision], If[LessEqual[t1, 2e+128], N[(v * N[(t1 / N[(N[(t1 + u), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(v / t$95$1), $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-t1\right) - u\\
\mathbf{if}\;t1 \leq -1.08 \cdot 10^{+159}:\\
\;\;\;\;\frac{v}{-t1}\\
\mathbf{elif}\;t1 \leq 2 \cdot 10^{+128}:\\
\;\;\;\;v \cdot \frac{t1}{\left(t1 + u\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{t\_1} \cdot 1\\
\end{array}
\end{array}
if t1 < -1.07999999999999991e159Initial program 47.1%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6495.1
Applied rewrites95.1%
if -1.07999999999999991e159 < t1 < 2.0000000000000002e128Initial program 80.3%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6487.1
Applied rewrites87.1%
if 2.0000000000000002e128 < t1 Initial program 45.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 rewrites92.5%
Final simplification89.4%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ v (- (- t1) u)) 1.0)))
(if (<= t1 -1.9e-42)
t_1
(if (<= t1 1.42e-12) (* (/ v (- u)) (/ t1 u)) t_1))))
double code(double u, double v, double t1) {
double t_1 = (v / (-t1 - u)) * 1.0;
double tmp;
if (t1 <= -1.9e-42) {
tmp = t_1;
} else if (t1 <= 1.42e-12) {
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)) * 1.0d0
if (t1 <= (-1.9d-42)) then
tmp = t_1
else if (t1 <= 1.42d-12) 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)) * 1.0;
double tmp;
if (t1 <= -1.9e-42) {
tmp = t_1;
} else if (t1 <= 1.42e-12) {
tmp = (v / -u) * (t1 / u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (v / (-t1 - u)) * 1.0 tmp = 0 if t1 <= -1.9e-42: tmp = t_1 elif t1 <= 1.42e-12: tmp = (v / -u) * (t1 / u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(v / Float64(Float64(-t1) - u)) * 1.0) tmp = 0.0 if (t1 <= -1.9e-42) tmp = t_1; elseif (t1 <= 1.42e-12) tmp = Float64(Float64(v / Float64(-u)) * Float64(t1 / u)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (v / (-t1 - u)) * 1.0; tmp = 0.0; if (t1 <= -1.9e-42) tmp = t_1; elseif (t1 <= 1.42e-12) tmp = (v / -u) * (t1 / u); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[t1, -1.9e-42], t$95$1, If[LessEqual[t1, 1.42e-12], N[(N[(v / (-u)), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{\left(-t1\right) - u} \cdot 1\\
\mathbf{if}\;t1 \leq -1.9 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.42 \cdot 10^{-12}:\\
\;\;\;\;\frac{v}{-u} \cdot \frac{t1}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.90000000000000009e-42 or 1.42e-12 < t1 Initial program 59.4%
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 rewrites85.6%
if -1.90000000000000009e-42 < t1 < 1.42e-12Initial program 80.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-/.f6495.3
Applied rewrites95.3%
Taylor expanded in t1 around 0
lower-/.f6475.7
Applied rewrites75.7%
Taylor expanded in t1 around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6477.8
Applied rewrites77.8%
Final simplification82.5%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ v (- (- t1) u)) 1.0)))
(if (<= t1 -1.85e-117)
t_1
(if (<= t1 1.42e-12) (* v (/ (- t1) (* u u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = (v / (-t1 - u)) * 1.0;
double tmp;
if (t1 <= -1.85e-117) {
tmp = t_1;
} else if (t1 <= 1.42e-12) {
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 / (-t1 - u)) * 1.0d0
if (t1 <= (-1.85d-117)) then
tmp = t_1
else if (t1 <= 1.42d-12) 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 / (-t1 - u)) * 1.0;
double tmp;
if (t1 <= -1.85e-117) {
tmp = t_1;
} else if (t1 <= 1.42e-12) {
tmp = v * (-t1 / (u * u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (v / (-t1 - u)) * 1.0 tmp = 0 if t1 <= -1.85e-117: tmp = t_1 elif t1 <= 1.42e-12: tmp = v * (-t1 / (u * u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(v / Float64(Float64(-t1) - u)) * 1.0) tmp = 0.0 if (t1 <= -1.85e-117) tmp = t_1; elseif (t1 <= 1.42e-12) 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 / (-t1 - u)) * 1.0; tmp = 0.0; if (t1 <= -1.85e-117) tmp = t_1; elseif (t1 <= 1.42e-12) tmp = v * (-t1 / (u * u)); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[t1, -1.85e-117], t$95$1, If[LessEqual[t1, 1.42e-12], N[(v * N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{\left(-t1\right) - u} \cdot 1\\
\mathbf{if}\;t1 \leq -1.85 \cdot 10^{-117}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.42 \cdot 10^{-12}:\\
\;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.8500000000000001e-117 or 1.42e-12 < t1 Initial program 60.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 rewrites81.4%
if -1.8500000000000001e-117 < t1 < 1.42e-12Initial program 82.4%
Taylor expanded in t1 around 0
unpow2N/A
lower-*.f6477.4
Applied rewrites77.4%
lift-/.f64N/A
clear-numN/A
lift-*.f64N/A
associate-/r*N/A
associate-/r/N/A
clear-numN/A
lower-*.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
Final simplification81.4%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ v (- (- t1) u)) 1.0)))
(if (<= t1 -1.9e-42)
t_1
(if (<= t1 1.42e-12) (* t1 (/ v (* u (- u)))) t_1))))
double code(double u, double v, double t1) {
double t_1 = (v / (-t1 - u)) * 1.0;
double tmp;
if (t1 <= -1.9e-42) {
tmp = t_1;
} else if (t1 <= 1.42e-12) {
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)) * 1.0d0
if (t1 <= (-1.9d-42)) then
tmp = t_1
else if (t1 <= 1.42d-12) 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)) * 1.0;
double tmp;
if (t1 <= -1.9e-42) {
tmp = t_1;
} else if (t1 <= 1.42e-12) {
tmp = t1 * (v / (u * -u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (v / (-t1 - u)) * 1.0 tmp = 0 if t1 <= -1.9e-42: tmp = t_1 elif t1 <= 1.42e-12: tmp = t1 * (v / (u * -u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(v / Float64(Float64(-t1) - u)) * 1.0) tmp = 0.0 if (t1 <= -1.9e-42) tmp = t_1; elseif (t1 <= 1.42e-12) 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 / (-t1 - u)) * 1.0; tmp = 0.0; if (t1 <= -1.9e-42) tmp = t_1; elseif (t1 <= 1.42e-12) tmp = t1 * (v / (u * -u)); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[t1, -1.9e-42], t$95$1, If[LessEqual[t1, 1.42e-12], N[(t1 * N[(v / N[(u * (-u)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{\left(-t1\right) - u} \cdot 1\\
\mathbf{if}\;t1 \leq -1.9 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.42 \cdot 10^{-12}:\\
\;\;\;\;t1 \cdot \frac{v}{u \cdot \left(-u\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.90000000000000009e-42 or 1.42e-12 < t1 Initial program 59.4%
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 rewrites85.6%
if -1.90000000000000009e-42 < t1 < 1.42e-12Initial program 80.9%
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.f6472.8
Applied rewrites72.8%
Final simplification80.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(t1 / Float64(t1 + u)) * Float64(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[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t1}{t1 + u} \cdot \frac{v}{\left(-t1\right) - u}
\end{array}
Initial program 68.1%
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.1
Applied rewrites98.1%
Final simplification98.1%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (* 1.0 (/ v (- u))))) (if (<= u -1.75e+223) t_1 (if (<= u 7e+218) (/ v (- t1)) t_1))))
double code(double u, double v, double t1) {
double t_1 = 1.0 * (v / -u);
double tmp;
if (u <= -1.75e+223) {
tmp = t_1;
} else if (u <= 7e+218) {
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 <= (-1.75d+223)) then
tmp = t_1
else if (u <= 7d+218) 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 <= -1.75e+223) {
tmp = t_1;
} else if (u <= 7e+218) {
tmp = v / -t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = 1.0 * (v / -u) tmp = 0 if u <= -1.75e+223: tmp = t_1 elif u <= 7e+218: tmp = v / -t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(1.0 * Float64(v / Float64(-u))) tmp = 0.0 if (u <= -1.75e+223) tmp = t_1; elseif (u <= 7e+218) 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 <= -1.75e+223) tmp = t_1; elseif (u <= 7e+218) 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, -1.75e+223], t$95$1, If[LessEqual[u, 7e+218], N[(v / (-t1)), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 1 \cdot \frac{v}{-u}\\
\mathbf{if}\;u \leq -1.75 \cdot 10^{+223}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;u \leq 7 \cdot 10^{+218}:\\
\;\;\;\;\frac{v}{-t1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if u < -1.75000000000000005e223 or 7.00000000000000038e218 < 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-/.f64100.0
Applied rewrites100.0%
Taylor expanded in t1 around inf
Applied rewrites60.6%
Taylor expanded in t1 around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6458.4
Applied rewrites58.4%
if -1.75000000000000005e223 < u < 7.00000000000000038e218Initial program 66.1%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6465.6
Applied rewrites65.6%
Final simplification64.4%
(FPCore (u v t1) :precision binary64 (* (/ v (- (- t1) u)) 1.0))
double code(double u, double v, double t1) {
return (v / (-t1 - u)) * 1.0;
}
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
end function
public static double code(double u, double v, double t1) {
return (v / (-t1 - u)) * 1.0;
}
def code(u, v, t1): return (v / (-t1 - u)) * 1.0
function code(u, v, t1) return Float64(Float64(v / Float64(Float64(-t1) - u)) * 1.0) end
function tmp = code(u, v, t1) tmp = (v / (-t1 - u)) * 1.0; end
code[u_, v_, t1_] := N[(N[(v / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * 1.0), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{\left(-t1\right) - u} \cdot 1
\end{array}
Initial program 68.1%
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.1
Applied rewrites98.1%
Taylor expanded in t1 around inf
Applied rewrites66.6%
Final simplification66.6%
(FPCore (u v t1) :precision binary64 (* v (/ 1.0 (- (- t1) u))))
double code(double u, double v, double t1) {
return v * (1.0 / (-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 * (1.0d0 / (-t1 - u))
end function
public static double code(double u, double v, double t1) {
return v * (1.0 / (-t1 - u));
}
def code(u, v, t1): return v * (1.0 / (-t1 - u))
function code(u, v, t1) return Float64(v * Float64(1.0 / Float64(Float64(-t1) - u))) end
function tmp = code(u, v, t1) tmp = v * (1.0 / (-t1 - u)); end
code[u_, v_, t1_] := N[(v * N[(1.0 / N[((-t1) - u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
v \cdot \frac{1}{\left(-t1\right) - u}
\end{array}
Initial program 68.1%
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-*.f64N/A
lift-neg.f64N/A
distribute-lft-neg-outN/A
distribute-rgt-neg-inN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f6473.4
Applied rewrites73.4%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
*-lft-identityN/A
lift-*.f64N/A
associate-/r*N/A
lift-/.f64N/A
lower-/.f6494.8
Applied rewrites94.8%
Taylor expanded in t1 around inf
Applied rewrites66.4%
Final simplification66.4%
(FPCore (u v t1) :precision binary64 (/ v (- t1)))
double code(double u, double v, double t1) {
return v / -t1;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = v / -t1
end function
public static double code(double u, double v, double t1) {
return v / -t1;
}
def code(u, v, t1): return v / -t1
function code(u, v, t1) return Float64(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 68.1%
Taylor expanded in t1 around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
Final simplification58.3%
herbie shell --seed 2024219
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))