
(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 (- u t1)) v) (+ (- u) t1)))
double code(double u, double v, double t1) {
return ((t1 / (u - t1)) * v) / (-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 = ((t1 / (u - t1)) * v) / (-u + t1)
end function
public static double code(double u, double v, double t1) {
return ((t1 / (u - t1)) * v) / (-u + t1);
}
def code(u, v, t1): return ((t1 / (u - t1)) * v) / (-u + t1)
function code(u, v, t1) return Float64(Float64(Float64(t1 / Float64(u - t1)) * v) / Float64(Float64(-u) + t1)) end
function tmp = code(u, v, t1) tmp = ((t1 / (u - t1)) * v) / (-u + t1); end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[(u - t1), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t1}{u - t1} \cdot v}{\left(-u\right) + t1}
\end{array}
Initial program 74.0%
Applied rewrites97.5%
Final simplification97.5%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* v (/ (- t1) (fma (fma 2.0 t1 u) u (* t1 t1)))))
(t_2 (/ (* -1.0 v) (+ (- u) t1))))
(if (<= t1 -4.2e+145)
t_2
(if (<= t1 -2.15e-162)
t_1
(if (<= t1 3.6e-140)
(/ (* (/ (- v) u) t1) u)
(if (<= t1 1.15e+154) t_1 t_2))))))
double code(double u, double v, double t1) {
double t_1 = v * (-t1 / fma(fma(2.0, t1, u), u, (t1 * t1)));
double t_2 = (-1.0 * v) / (-u + t1);
double tmp;
if (t1 <= -4.2e+145) {
tmp = t_2;
} else if (t1 <= -2.15e-162) {
tmp = t_1;
} else if (t1 <= 3.6e-140) {
tmp = ((-v / u) * t1) / u;
} else if (t1 <= 1.15e+154) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(u, v, t1) t_1 = Float64(v * Float64(Float64(-t1) / fma(fma(2.0, t1, u), u, Float64(t1 * t1)))) t_2 = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)) tmp = 0.0 if (t1 <= -4.2e+145) tmp = t_2; elseif (t1 <= -2.15e-162) tmp = t_1; elseif (t1 <= 3.6e-140) tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); elseif (t1 <= 1.15e+154) tmp = t_1; else tmp = t_2; end return tmp end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v * N[((-t1) / N[(N[(2.0 * t1 + u), $MachinePrecision] * u + N[(t1 * t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -4.2e+145], t$95$2, If[LessEqual[t1, -2.15e-162], t$95$1, If[LessEqual[t1, 3.6e-140], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision], If[LessEqual[t1, 1.15e+154], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := v \cdot \frac{-t1}{\mathsf{fma}\left(\mathsf{fma}\left(2, t1, u\right), u, t1 \cdot t1\right)}\\
t_2 := \frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{if}\;t1 \leq -4.2 \cdot 10^{+145}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq -2.15 \cdot 10^{-162}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 3.6 \cdot 10^{-140}:\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\mathbf{elif}\;t1 \leq 1.15 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t1 < -4.19999999999999979e145 or 1.15e154 < t1 Initial program 43.9%
Applied rewrites100.0%
Taylor expanded in u around 0
Applied rewrites96.9%
if -4.19999999999999979e145 < t1 < -2.14999999999999998e-162 or 3.6e-140 < t1 < 1.15e154Initial program 86.2%
Taylor expanded in u around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6486.2
Applied rewrites86.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6491.4
Applied rewrites91.4%
if -2.14999999999999998e-162 < t1 < 3.6e-140Initial program 79.6%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6487.6
Applied rewrites87.6%
Applied rewrites90.2%
Final simplification92.5%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.46e+121) (not (<= t1 1.5e+107))) (/ (* -1.0 v) (+ (- u) t1)) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.46e+121) || !(t1 <= 1.5e+107)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 * v) / ((t1 + u) * (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 <= (-1.46d+121)) .or. (.not. (t1 <= 1.5d+107))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.46e+121) || !(t1 <= 1.5e+107)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.46e+121) or not (t1 <= 1.5e+107): tmp = (-1.0 * v) / (-u + t1) else: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.46e+121) || !(t1 <= 1.5e+107)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.46e+121) || ~((t1 <= 1.5e+107))) tmp = (-1.0 * v) / (-u + t1); else tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.46e+121], N[Not[LessEqual[t1, 1.5e+107]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.46 \cdot 10^{+121} \lor \neg \left(t1 \leq 1.5 \cdot 10^{+107}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\end{array}
\end{array}
if t1 < -1.4600000000000001e121 or 1.50000000000000012e107 < t1 Initial program 49.5%
Applied rewrites100.0%
Taylor expanded in u around 0
Applied rewrites94.8%
if -1.4600000000000001e121 < t1 < 1.50000000000000012e107Initial program 84.2%
Final simplification87.3%
(FPCore (u v t1) :precision binary64 (if (or (<= u -240000000000.0) (not (<= u 9.5e-13))) (/ (* (/ (- v) u) t1) u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -240000000000.0) || !(u <= 9.5e-13)) {
tmp = ((-v / u) * t1) / u;
} else {
tmp = -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 ((u <= (-240000000000.0d0)) .or. (.not. (u <= 9.5d-13))) then
tmp = ((-v / u) * t1) / u
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -240000000000.0) || !(u <= 9.5e-13)) {
tmp = ((-v / u) * t1) / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -240000000000.0) or not (u <= 9.5e-13): tmp = ((-v / u) * t1) / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -240000000000.0) || !(u <= 9.5e-13)) tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -240000000000.0) || ~((u <= 9.5e-13))) tmp = ((-v / u) * t1) / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -240000000000.0], N[Not[LessEqual[u, 9.5e-13]], $MachinePrecision]], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -240000000000 \lor \neg \left(u \leq 9.5 \cdot 10^{-13}\right):\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -2.4e11 or 9.49999999999999991e-13 < u Initial program 78.2%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6481.3
Applied rewrites81.3%
Applied rewrites82.5%
if -2.4e11 < u < 9.49999999999999991e-13Initial program 69.4%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6479.6
Applied rewrites79.6%
Final simplification81.1%
(FPCore (u v t1) :precision binary64 (if (or (<= u -240000000000.0) (not (<= u 9.5e-13))) (* (/ (/ (- v) u) u) t1) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -240000000000.0) || !(u <= 9.5e-13)) {
tmp = ((-v / u) / u) * t1;
} else {
tmp = -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 ((u <= (-240000000000.0d0)) .or. (.not. (u <= 9.5d-13))) then
tmp = ((-v / u) / u) * t1
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -240000000000.0) || !(u <= 9.5e-13)) {
tmp = ((-v / u) / u) * t1;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -240000000000.0) or not (u <= 9.5e-13): tmp = ((-v / u) / u) * t1 else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -240000000000.0) || !(u <= 9.5e-13)) tmp = Float64(Float64(Float64(Float64(-v) / u) / u) * t1); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -240000000000.0) || ~((u <= 9.5e-13))) tmp = ((-v / u) / u) * t1; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -240000000000.0], N[Not[LessEqual[u, 9.5e-13]], $MachinePrecision]], N[(N[(N[((-v) / u), $MachinePrecision] / u), $MachinePrecision] * t1), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -240000000000 \lor \neg \left(u \leq 9.5 \cdot 10^{-13}\right):\\
\;\;\;\;\frac{\frac{-v}{u}}{u} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -2.4e11 or 9.49999999999999991e-13 < u Initial program 78.2%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6481.3
Applied rewrites81.3%
Applied rewrites71.5%
Taylor expanded in u around 0
Applied rewrites80.8%
if -2.4e11 < u < 9.49999999999999991e-13Initial program 69.4%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6479.6
Applied rewrites79.6%
Final simplification80.3%
(FPCore (u v t1) :precision binary64 (if (<= u -240000000000.0) (/ (* (/ t1 u) v) (- u)) (if (<= u 9.5e-13) (/ (- v) t1) (* (/ (/ (- v) u) u) t1))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -240000000000.0) {
tmp = ((t1 / u) * v) / -u;
} else if (u <= 9.5e-13) {
tmp = -v / t1;
} else {
tmp = ((-v / u) / u) * 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 (u <= (-240000000000.0d0)) then
tmp = ((t1 / u) * v) / -u
else if (u <= 9.5d-13) then
tmp = -v / t1
else
tmp = ((-v / u) / u) * t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -240000000000.0) {
tmp = ((t1 / u) * v) / -u;
} else if (u <= 9.5e-13) {
tmp = -v / t1;
} else {
tmp = ((-v / u) / u) * t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -240000000000.0: tmp = ((t1 / u) * v) / -u elif u <= 9.5e-13: tmp = -v / t1 else: tmp = ((-v / u) / u) * t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -240000000000.0) tmp = Float64(Float64(Float64(t1 / u) * v) / Float64(-u)); elseif (u <= 9.5e-13) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(Float64(Float64(-v) / u) / u) * t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -240000000000.0) tmp = ((t1 / u) * v) / -u; elseif (u <= 9.5e-13) tmp = -v / t1; else tmp = ((-v / u) / u) * t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -240000000000.0], N[(N[(N[(t1 / u), $MachinePrecision] * v), $MachinePrecision] / (-u)), $MachinePrecision], If[LessEqual[u, 9.5e-13], N[((-v) / t1), $MachinePrecision], N[(N[(N[((-v) / u), $MachinePrecision] / u), $MachinePrecision] * t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -240000000000:\\
\;\;\;\;\frac{\frac{t1}{u} \cdot v}{-u}\\
\mathbf{elif}\;u \leq 9.5 \cdot 10^{-13}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-v}{u}}{u} \cdot t1\\
\end{array}
\end{array}
if u < -2.4e11Initial program 74.4%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6478.8
Applied rewrites78.8%
Applied rewrites66.8%
Applied rewrites78.8%
if -2.4e11 < u < 9.49999999999999991e-13Initial program 69.4%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6479.6
Applied rewrites79.6%
if 9.49999999999999991e-13 < u Initial program 81.8%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6483.6
Applied rewrites83.6%
Applied rewrites75.9%
Taylor expanded in u around 0
Applied rewrites84.2%
(FPCore (u v t1) :precision binary64 (if (<= u -240000000000.0) (* (/ v u) (/ (- t1) u)) (if (<= u 9.5e-13) (/ (- v) t1) (* (/ (/ (- v) u) u) t1))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -240000000000.0) {
tmp = (v / u) * (-t1 / u);
} else if (u <= 9.5e-13) {
tmp = -v / t1;
} else {
tmp = ((-v / u) / u) * 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 (u <= (-240000000000.0d0)) then
tmp = (v / u) * (-t1 / u)
else if (u <= 9.5d-13) then
tmp = -v / t1
else
tmp = ((-v / u) / u) * t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -240000000000.0) {
tmp = (v / u) * (-t1 / u);
} else if (u <= 9.5e-13) {
tmp = -v / t1;
} else {
tmp = ((-v / u) / u) * t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -240000000000.0: tmp = (v / u) * (-t1 / u) elif u <= 9.5e-13: tmp = -v / t1 else: tmp = ((-v / u) / u) * t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -240000000000.0) tmp = Float64(Float64(v / u) * Float64(Float64(-t1) / u)); elseif (u <= 9.5e-13) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(Float64(Float64(-v) / u) / u) * t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -240000000000.0) tmp = (v / u) * (-t1 / u); elseif (u <= 9.5e-13) tmp = -v / t1; else tmp = ((-v / u) / u) * t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -240000000000.0], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 9.5e-13], N[((-v) / t1), $MachinePrecision], N[(N[(N[((-v) / u), $MachinePrecision] / u), $MachinePrecision] * t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -240000000000:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\mathbf{elif}\;u \leq 9.5 \cdot 10^{-13}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-v}{u}}{u} \cdot t1\\
\end{array}
\end{array}
if u < -2.4e11Initial program 74.4%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6478.8
Applied rewrites78.8%
if -2.4e11 < u < 9.49999999999999991e-13Initial program 69.4%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6479.6
Applied rewrites79.6%
if 9.49999999999999991e-13 < u Initial program 81.8%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6483.6
Applied rewrites83.6%
Applied rewrites75.9%
Taylor expanded in u around 0
Applied rewrites84.2%
Final simplification80.7%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -52.0) (not (<= t1 8e-11))) (/ (* -1.0 v) (+ (- u) t1)) (/ (* (- t1) v) (* u u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -52.0) || !(t1 <= 8e-11)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 * v) / (u * 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 <= (-52.0d0)) .or. (.not. (t1 <= 8d-11))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = (-t1 * v) / (u * u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -52.0) || !(t1 <= 8e-11)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = (-t1 * v) / (u * u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -52.0) or not (t1 <= 8e-11): tmp = (-1.0 * v) / (-u + t1) else: tmp = (-t1 * v) / (u * u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -52.0) || !(t1 <= 8e-11)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(Float64(-t1) * v) / Float64(u * u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -52.0) || ~((t1 <= 8e-11))) tmp = (-1.0 * v) / (-u + t1); else tmp = (-t1 * v) / (u * u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -52.0], N[Not[LessEqual[t1, 8e-11]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) * v), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -52 \lor \neg \left(t1 \leq 8 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -52 or 7.99999999999999952e-11 < t1 Initial program 63.7%
Applied rewrites98.4%
Taylor expanded in u around 0
Applied rewrites81.2%
if -52 < t1 < 7.99999999999999952e-11Initial program 85.3%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6474.8
Applied rewrites74.8%
Final simplification78.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -52.0) (not (<= t1 8e-11))) (/ (* -1.0 v) (+ (- u) t1)) (* (- t1) (/ v (* u u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -52.0) || !(t1 <= 8e-11)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -t1 * (v / (u * 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 <= (-52.0d0)) .or. (.not. (t1 <= 8d-11))) then
tmp = ((-1.0d0) * v) / (-u + t1)
else
tmp = -t1 * (v / (u * u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -52.0) || !(t1 <= 8e-11)) {
tmp = (-1.0 * v) / (-u + t1);
} else {
tmp = -t1 * (v / (u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -52.0) or not (t1 <= 8e-11): tmp = (-1.0 * v) / (-u + t1) else: tmp = -t1 * (v / (u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -52.0) || !(t1 <= 8e-11)) tmp = Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)); else tmp = Float64(Float64(-t1) * Float64(v / Float64(u * u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -52.0) || ~((t1 <= 8e-11))) tmp = (-1.0 * v) / (-u + t1); else tmp = -t1 * (v / (u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -52.0], N[Not[LessEqual[t1, 8e-11]], $MachinePrecision]], N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision], N[((-t1) * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -52 \lor \neg \left(t1 \leq 8 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{-1 \cdot v}{\left(-u\right) + t1}\\
\mathbf{else}:\\
\;\;\;\;\left(-t1\right) \cdot \frac{v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -52 or 7.99999999999999952e-11 < t1 Initial program 63.7%
Applied rewrites98.4%
Taylor expanded in u around 0
Applied rewrites81.2%
if -52 < t1 < 7.99999999999999952e-11Initial program 85.3%
Taylor expanded in u around inf
mul-1-negN/A
*-commutativeN/A
unpow2N/A
times-fracN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
distribute-frac-negN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f6480.0
Applied rewrites80.0%
Taylor expanded in u around 0
Applied rewrites74.2%
Final simplification77.9%
(FPCore (u v t1) :precision binary64 (/ (* -1.0 v) (+ (- u) t1)))
double code(double u, double v, double t1) {
return (-1.0 * v) / (-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 = ((-1.0d0) * v) / (-u + t1)
end function
public static double code(double u, double v, double t1) {
return (-1.0 * v) / (-u + t1);
}
def code(u, v, t1): return (-1.0 * v) / (-u + t1)
function code(u, v, t1) return Float64(Float64(-1.0 * v) / Float64(Float64(-u) + t1)) end
function tmp = code(u, v, t1) tmp = (-1.0 * v) / (-u + t1); end
code[u_, v_, t1_] := N[(N[(-1.0 * v), $MachinePrecision] / N[((-u) + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-1 \cdot v}{\left(-u\right) + t1}
\end{array}
Initial program 74.0%
Applied rewrites97.5%
Taylor expanded in u around 0
Applied rewrites60.4%
Final simplification60.4%
(FPCore (u v t1) :precision binary64 (* (- v) (/ -1.0 (- u t1))))
double code(double u, double v, double t1) {
return -v * (-1.0 / (u - t1));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v * ((-1.0d0) / (u - t1))
end function
public static double code(double u, double v, double t1) {
return -v * (-1.0 / (u - t1));
}
def code(u, v, t1): return -v * (-1.0 / (u - t1))
function code(u, v, t1) return Float64(Float64(-v) * Float64(-1.0 / Float64(u - t1))) end
function tmp = code(u, v, t1) tmp = -v * (-1.0 / (u - t1)); end
code[u_, v_, t1_] := N[((-v) * N[(-1.0 / N[(u - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-v\right) \cdot \frac{-1}{u - t1}
\end{array}
Initial program 74.0%
Applied rewrites97.5%
Taylor expanded in u around 0
Applied rewrites60.4%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f6460.2
Applied rewrites60.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(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 74.0%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6452.1
Applied rewrites52.1%
herbie shell --seed 2024337
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))