
(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)) * 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 \frac{v}{t1 + u}
\end{array}
Initial program 67.0%
times-frac98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ (- t1) u) (/ v u))))
(if (<= u -0.0135)
t_1
(if (<= u 2.3e-80)
(/ (- v) t1)
(if (or (<= u 0.0036) (not (<= u 1.1e+70)))
t_1
(/ v (- (* u -2.0) t1)))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 / u) * (v / u);
double tmp;
if (u <= -0.0135) {
tmp = t_1;
} else if (u <= 2.3e-80) {
tmp = -v / t1;
} else if ((u <= 0.0036) || !(u <= 1.1e+70)) {
tmp = t_1;
} else {
tmp = v / ((u * -2.0) - t1);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = (-t1 / u) * (v / u)
if (u <= (-0.0135d0)) then
tmp = t_1
else if (u <= 2.3d-80) then
tmp = -v / t1
else if ((u <= 0.0036d0) .or. (.not. (u <= 1.1d+70))) then
tmp = t_1
else
tmp = v / ((u * (-2.0d0)) - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = (-t1 / u) * (v / u);
double tmp;
if (u <= -0.0135) {
tmp = t_1;
} else if (u <= 2.3e-80) {
tmp = -v / t1;
} else if ((u <= 0.0036) || !(u <= 1.1e+70)) {
tmp = t_1;
} else {
tmp = v / ((u * -2.0) - t1);
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 / u) * (v / u) tmp = 0 if u <= -0.0135: tmp = t_1 elif u <= 2.3e-80: tmp = -v / t1 elif (u <= 0.0036) or not (u <= 1.1e+70): tmp = t_1 else: tmp = v / ((u * -2.0) - t1) return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) / u) * Float64(v / u)) tmp = 0.0 if (u <= -0.0135) tmp = t_1; elseif (u <= 2.3e-80) tmp = Float64(Float64(-v) / t1); elseif ((u <= 0.0036) || !(u <= 1.1e+70)) tmp = t_1; else tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 / u) * (v / u); tmp = 0.0; if (u <= -0.0135) tmp = t_1; elseif (u <= 2.3e-80) tmp = -v / t1; elseif ((u <= 0.0036) || ~((u <= 1.1e+70))) tmp = t_1; else tmp = v / ((u * -2.0) - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) / u), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -0.0135], t$95$1, If[LessEqual[u, 2.3e-80], N[((-v) / t1), $MachinePrecision], If[Or[LessEqual[u, 0.0036], N[Not[LessEqual[u, 1.1e+70]], $MachinePrecision]], t$95$1, N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-t1}{u} \cdot \frac{v}{u}\\
\mathbf{if}\;u \leq -0.0135:\\
\;\;\;\;t_1\\
\mathbf{elif}\;u \leq 2.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{elif}\;u \leq 0.0036 \lor \neg \left(u \leq 1.1 \cdot 10^{+70}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\end{array}
\end{array}
if u < -0.0134999999999999998 or 2.2999999999999998e-80 < u < 0.0035999999999999999 or 1.1e70 < u Initial program 72.3%
times-frac98.5%
Simplified98.5%
Taylor expanded in t1 around 0 84.0%
associate-*r/84.0%
mul-1-neg84.0%
Simplified84.0%
Taylor expanded in t1 around 0 81.9%
if -0.0134999999999999998 < u < 2.2999999999999998e-80Initial program 60.0%
times-frac99.1%
Simplified99.1%
Taylor expanded in t1 around inf 86.1%
associate-*r/86.1%
neg-mul-186.1%
Simplified86.1%
if 0.0035999999999999999 < u < 1.1e70Initial program 70.9%
associate-/r*77.1%
*-commutative77.1%
associate-/l*99.7%
associate-/l/99.7%
+-commutative99.7%
remove-double-neg99.7%
unsub-neg99.7%
div-sub99.7%
sub-neg99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in t1 around inf 72.0%
mul-1-neg72.0%
unsub-neg72.0%
*-commutative72.0%
Simplified72.0%
Final simplification83.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ (- t1) u) (/ v u))))
(if (<= u -0.15)
t_1
(if (<= u 2.3e-80)
(/ (- v) t1)
(if (<= u 0.018)
(* v (/ t1 (* u (- t1 u))))
(if (<= u 9.5e+69) (/ v (- (* u -2.0) t1)) t_1))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 / u) * (v / u);
double tmp;
if (u <= -0.15) {
tmp = t_1;
} else if (u <= 2.3e-80) {
tmp = -v / t1;
} else if (u <= 0.018) {
tmp = v * (t1 / (u * (t1 - u)));
} else if (u <= 9.5e+69) {
tmp = v / ((u * -2.0) - 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 / u) * (v / u)
if (u <= (-0.15d0)) then
tmp = t_1
else if (u <= 2.3d-80) then
tmp = -v / t1
else if (u <= 0.018d0) then
tmp = v * (t1 / (u * (t1 - u)))
else if (u <= 9.5d+69) then
tmp = v / ((u * (-2.0d0)) - 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 / u) * (v / u);
double tmp;
if (u <= -0.15) {
tmp = t_1;
} else if (u <= 2.3e-80) {
tmp = -v / t1;
} else if (u <= 0.018) {
tmp = v * (t1 / (u * (t1 - u)));
} else if (u <= 9.5e+69) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 / u) * (v / u) tmp = 0 if u <= -0.15: tmp = t_1 elif u <= 2.3e-80: tmp = -v / t1 elif u <= 0.018: tmp = v * (t1 / (u * (t1 - u))) elif u <= 9.5e+69: tmp = v / ((u * -2.0) - t1) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) / u) * Float64(v / u)) tmp = 0.0 if (u <= -0.15) tmp = t_1; elseif (u <= 2.3e-80) tmp = Float64(Float64(-v) / t1); elseif (u <= 0.018) tmp = Float64(v * Float64(t1 / Float64(u * Float64(t1 - u)))); elseif (u <= 9.5e+69) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 / u) * (v / u); tmp = 0.0; if (u <= -0.15) tmp = t_1; elseif (u <= 2.3e-80) tmp = -v / t1; elseif (u <= 0.018) tmp = v * (t1 / (u * (t1 - u))); elseif (u <= 9.5e+69) tmp = v / ((u * -2.0) - t1); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) / u), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -0.15], t$95$1, If[LessEqual[u, 2.3e-80], N[((-v) / t1), $MachinePrecision], If[LessEqual[u, 0.018], N[(v * N[(t1 / N[(u * N[(t1 - u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 9.5e+69], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-t1}{u} \cdot \frac{v}{u}\\
\mathbf{if}\;u \leq -0.15:\\
\;\;\;\;t_1\\
\mathbf{elif}\;u \leq 2.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{elif}\;u \leq 0.018:\\
\;\;\;\;v \cdot \frac{t1}{u \cdot \left(t1 - u\right)}\\
\mathbf{elif}\;u \leq 9.5 \cdot 10^{+69}:\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if u < -0.149999999999999994 or 9.4999999999999995e69 < u Initial program 69.5%
times-frac98.3%
Simplified98.3%
Taylor expanded in t1 around 0 85.0%
associate-*r/85.0%
mul-1-neg85.0%
Simplified85.0%
Taylor expanded in t1 around 0 83.4%
if -0.149999999999999994 < u < 2.2999999999999998e-80Initial program 60.0%
times-frac99.1%
Simplified99.1%
Taylor expanded in t1 around inf 86.1%
associate-*r/86.1%
neg-mul-186.1%
Simplified86.1%
if 2.2999999999999998e-80 < u < 0.0179999999999999986Initial program 89.9%
times-frac99.4%
Simplified99.4%
Taylor expanded in t1 around 0 77.7%
associate-*r/77.7%
mul-1-neg77.7%
Simplified77.7%
associate-*r/72.7%
frac-2neg72.7%
div-inv72.7%
div-inv72.7%
add-sqr-sqrt22.1%
sqrt-unprod29.9%
sqr-neg29.9%
sqrt-unprod18.2%
add-sqr-sqrt30.4%
distribute-lft-neg-out30.4%
distribute-frac-neg30.4%
*-commutative30.4%
add-sqr-sqrt12.2%
sqrt-unprod41.4%
sqr-neg41.4%
sqrt-unprod50.4%
add-sqr-sqrt72.7%
distribute-neg-in72.7%
Applied egg-rr73.2%
associate-/l*73.2%
Simplified73.2%
clear-num73.1%
associate-/r/73.2%
clear-num73.3%
associate-/l/73.3%
Applied egg-rr73.3%
if 0.0179999999999999986 < u < 9.4999999999999995e69Initial program 70.9%
associate-/r*77.1%
*-commutative77.1%
associate-/l*99.7%
associate-/l/99.7%
+-commutative99.7%
remove-double-neg99.7%
unsub-neg99.7%
div-sub99.7%
sub-neg99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in t1 around inf 72.0%
mul-1-neg72.0%
unsub-neg72.0%
*-commutative72.0%
Simplified72.0%
Final simplification83.1%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ (- t1) u) (/ v u))))
(if (<= u -0.0021)
t_1
(if (<= u 2.3e-80)
(/ (- v) t1)
(if (<= u 110.0)
(/ v (* u (/ (- t1 u) t1)))
(if (<= u 1.05e+70) (/ v (- (* u -2.0) t1)) t_1))))))
double code(double u, double v, double t1) {
double t_1 = (-t1 / u) * (v / u);
double tmp;
if (u <= -0.0021) {
tmp = t_1;
} else if (u <= 2.3e-80) {
tmp = -v / t1;
} else if (u <= 110.0) {
tmp = v / (u * ((t1 - u) / t1));
} else if (u <= 1.05e+70) {
tmp = v / ((u * -2.0) - 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 / u) * (v / u)
if (u <= (-0.0021d0)) then
tmp = t_1
else if (u <= 2.3d-80) then
tmp = -v / t1
else if (u <= 110.0d0) then
tmp = v / (u * ((t1 - u) / t1))
else if (u <= 1.05d+70) then
tmp = v / ((u * (-2.0d0)) - 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 / u) * (v / u);
double tmp;
if (u <= -0.0021) {
tmp = t_1;
} else if (u <= 2.3e-80) {
tmp = -v / t1;
} else if (u <= 110.0) {
tmp = v / (u * ((t1 - u) / t1));
} else if (u <= 1.05e+70) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-t1 / u) * (v / u) tmp = 0 if u <= -0.0021: tmp = t_1 elif u <= 2.3e-80: tmp = -v / t1 elif u <= 110.0: tmp = v / (u * ((t1 - u) / t1)) elif u <= 1.05e+70: tmp = v / ((u * -2.0) - t1) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-t1) / u) * Float64(v / u)) tmp = 0.0 if (u <= -0.0021) tmp = t_1; elseif (u <= 2.3e-80) tmp = Float64(Float64(-v) / t1); elseif (u <= 110.0) tmp = Float64(v / Float64(u * Float64(Float64(t1 - u) / t1))); elseif (u <= 1.05e+70) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-t1 / u) * (v / u); tmp = 0.0; if (u <= -0.0021) tmp = t_1; elseif (u <= 2.3e-80) tmp = -v / t1; elseif (u <= 110.0) tmp = v / (u * ((t1 - u) / t1)); elseif (u <= 1.05e+70) tmp = v / ((u * -2.0) - t1); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(N[((-t1) / u), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -0.0021], t$95$1, If[LessEqual[u, 2.3e-80], N[((-v) / t1), $MachinePrecision], If[LessEqual[u, 110.0], N[(v / N[(u * N[(N[(t1 - u), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 1.05e+70], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-t1}{u} \cdot \frac{v}{u}\\
\mathbf{if}\;u \leq -0.0021:\\
\;\;\;\;t_1\\
\mathbf{elif}\;u \leq 2.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{elif}\;u \leq 110:\\
\;\;\;\;\frac{v}{u \cdot \frac{t1 - u}{t1}}\\
\mathbf{elif}\;u \leq 1.05 \cdot 10^{+70}:\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if u < -0.00209999999999999987 or 1.05000000000000004e70 < u Initial program 69.5%
times-frac98.3%
Simplified98.3%
Taylor expanded in t1 around 0 85.0%
associate-*r/85.0%
mul-1-neg85.0%
Simplified85.0%
Taylor expanded in t1 around 0 83.4%
if -0.00209999999999999987 < u < 2.2999999999999998e-80Initial program 60.0%
times-frac99.1%
Simplified99.1%
Taylor expanded in t1 around inf 86.1%
associate-*r/86.1%
neg-mul-186.1%
Simplified86.1%
if 2.2999999999999998e-80 < u < 110Initial program 89.9%
times-frac99.4%
Simplified99.4%
Taylor expanded in t1 around 0 77.7%
associate-*r/77.7%
mul-1-neg77.7%
Simplified77.7%
associate-*r/72.7%
frac-2neg72.7%
div-inv72.7%
div-inv72.7%
add-sqr-sqrt22.1%
sqrt-unprod29.9%
sqr-neg29.9%
sqrt-unprod18.2%
add-sqr-sqrt30.4%
distribute-lft-neg-out30.4%
distribute-frac-neg30.4%
*-commutative30.4%
add-sqr-sqrt12.2%
sqrt-unprod41.4%
sqr-neg41.4%
sqrt-unprod50.4%
add-sqr-sqrt72.7%
distribute-neg-in72.7%
Applied egg-rr73.2%
associate-/l*73.2%
Simplified73.2%
associate-/r/73.5%
Applied egg-rr73.5%
if 110 < u < 1.05000000000000004e70Initial program 70.9%
associate-/r*77.1%
*-commutative77.1%
associate-/l*99.7%
associate-/l/99.7%
+-commutative99.7%
remove-double-neg99.7%
unsub-neg99.7%
div-sub99.7%
sub-neg99.7%
*-inverses99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in t1 around inf 72.0%
mul-1-neg72.0%
unsub-neg72.0%
*-commutative72.0%
Simplified72.0%
Final simplification83.1%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.36e-27) (not (<= u 2.3e-80))) (/ (/ v (/ (- t1 u) t1)) (+ t1 u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.36e-27) || !(u <= 2.3e-80)) {
tmp = (v / ((t1 - u) / t1)) / (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 <= (-1.36d-27)) .or. (.not. (u <= 2.3d-80))) then
tmp = (v / ((t1 - u) / t1)) / (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 <= -1.36e-27) || !(u <= 2.3e-80)) {
tmp = (v / ((t1 - u) / t1)) / (t1 + u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.36e-27) or not (u <= 2.3e-80): tmp = (v / ((t1 - u) / t1)) / (t1 + u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.36e-27) || !(u <= 2.3e-80)) tmp = Float64(Float64(v / Float64(Float64(t1 - u) / t1)) / Float64(t1 + u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.36e-27) || ~((u <= 2.3e-80))) tmp = (v / ((t1 - u) / t1)) / (t1 + u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.36e-27], N[Not[LessEqual[u, 2.3e-80]], $MachinePrecision]], N[(N[(v / N[(N[(t1 - u), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision] / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.36 \cdot 10^{-27} \lor \neg \left(u \leq 2.3 \cdot 10^{-80}\right):\\
\;\;\;\;\frac{\frac{v}{\frac{t1 - u}{t1}}}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -1.36e-27 or 2.2999999999999998e-80 < u Initial program 73.2%
times-frac98.7%
Simplified98.7%
associate-*r/98.6%
clear-num98.5%
associate-*l/98.5%
*-un-lft-identity98.5%
frac-2neg98.5%
distribute-neg-in98.5%
add-sqr-sqrt48.5%
sqrt-unprod83.2%
sqr-neg83.2%
sqrt-unprod41.3%
add-sqr-sqrt80.6%
sub-neg80.6%
remove-double-neg80.6%
Applied egg-rr80.6%
if -1.36e-27 < u < 2.2999999999999998e-80Initial program 57.6%
times-frac99.0%
Simplified99.0%
Taylor expanded in t1 around inf 87.1%
associate-*r/87.1%
neg-mul-187.1%
Simplified87.1%
Final simplification83.2%
(FPCore (u v t1) :precision binary64 (if (or (<= u -0.025) (not (<= u 2.3e-80))) (* (/ v (+ t1 u)) (/ (- t1) u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -0.025) || !(u <= 2.3e-80)) {
tmp = (v / (t1 + 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 <= (-0.025d0)) .or. (.not. (u <= 2.3d-80))) then
tmp = (v / (t1 + 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 <= -0.025) || !(u <= 2.3e-80)) {
tmp = (v / (t1 + u)) * (-t1 / u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -0.025) or not (u <= 2.3e-80): tmp = (v / (t1 + u)) * (-t1 / u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -0.025) || !(u <= 2.3e-80)) tmp = Float64(Float64(v / Float64(t1 + u)) * Float64(Float64(-t1) / u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -0.025) || ~((u <= 2.3e-80))) tmp = (v / (t1 + u)) * (-t1 / u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -0.025], N[Not[LessEqual[u, 2.3e-80]], $MachinePrecision]], N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -0.025 \lor \neg \left(u \leq 2.3 \cdot 10^{-80}\right):\\
\;\;\;\;\frac{v}{t1 + u} \cdot \frac{-t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -0.025000000000000001 or 2.2999999999999998e-80 < u Initial program 72.2%
times-frac98.6%
Simplified98.6%
Taylor expanded in t1 around 0 80.6%
associate-*r/80.6%
mul-1-neg80.6%
Simplified80.6%
if -0.025000000000000001 < u < 2.2999999999999998e-80Initial program 60.0%
times-frac99.1%
Simplified99.1%
Taylor expanded in t1 around inf 86.1%
associate-*r/86.1%
neg-mul-186.1%
Simplified86.1%
Final simplification82.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -4.9e+126) (not (<= t1 2.3e+114))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4.9e+126) || !(t1 <= 2.3e+114)) {
tmp = v / t1;
} else {
tmp = v / 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 <= (-4.9d+126)) .or. (.not. (t1 <= 2.3d+114))) then
tmp = v / t1
else
tmp = v / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4.9e+126) || !(t1 <= 2.3e+114)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -4.9e+126) or not (t1 <= 2.3e+114): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -4.9e+126) || !(t1 <= 2.3e+114)) tmp = Float64(v / t1); else tmp = Float64(v / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -4.9e+126) || ~((t1 <= 2.3e+114))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -4.9e+126], N[Not[LessEqual[t1, 2.3e+114]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4.9 \cdot 10^{+126} \lor \neg \left(t1 \leq 2.3 \cdot 10^{+114}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -4.90000000000000001e126 or 2.3e114 < t1 Initial program 41.3%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around inf 91.8%
Taylor expanded in u around inf 36.9%
if -4.90000000000000001e126 < t1 < 2.3e114Initial program 78.7%
times-frac98.3%
Simplified98.3%
Taylor expanded in t1 around 0 69.0%
associate-*r/69.0%
mul-1-neg69.0%
Simplified69.0%
associate-*r/68.4%
frac-2neg68.4%
div-inv68.4%
div-inv68.4%
add-sqr-sqrt33.4%
sqrt-unprod45.7%
sqr-neg45.7%
sqrt-unprod16.6%
add-sqr-sqrt34.1%
distribute-lft-neg-out34.1%
distribute-frac-neg34.1%
*-commutative34.1%
add-sqr-sqrt17.5%
sqrt-unprod44.5%
sqr-neg44.5%
sqrt-unprod34.8%
add-sqr-sqrt68.4%
distribute-neg-in68.4%
Applied egg-rr67.8%
Taylor expanded in t1 around inf 16.6%
Final simplification22.9%
(FPCore (u v t1) :precision binary64 (if (<= u -7e+148) (* v (/ -0.5 u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (u <= -7e+148) {
tmp = v * (-0.5 / 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 <= (-7d+148)) then
tmp = v * ((-0.5d0) / 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 <= -7e+148) {
tmp = v * (-0.5 / u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -7e+148: tmp = v * (-0.5 / u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -7e+148) tmp = Float64(v * Float64(-0.5 / u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -7e+148) tmp = v * (-0.5 / u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -7e+148], N[(v * N[(-0.5 / u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -7 \cdot 10^{+148}:\\
\;\;\;\;v \cdot \frac{-0.5}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -6.9999999999999998e148Initial program 62.8%
associate-/r*92.0%
*-commutative92.0%
associate-/l*97.3%
associate-/l/77.9%
+-commutative77.9%
remove-double-neg77.9%
unsub-neg77.9%
div-sub77.9%
sub-neg77.9%
*-inverses77.9%
metadata-eval77.9%
Simplified77.9%
Taylor expanded in t1 around inf 47.2%
mul-1-neg47.2%
unsub-neg47.2%
*-commutative47.2%
Simplified47.2%
div-inv47.2%
Applied egg-rr47.2%
Taylor expanded in u around inf 44.7%
if -6.9999999999999998e148 < u Initial program 67.8%
times-frac99.0%
Simplified99.0%
Taylor expanded in t1 around inf 60.0%
associate-*r/60.0%
neg-mul-160.0%
Simplified60.0%
Final simplification57.7%
(FPCore (u v t1) :precision binary64 (/ v (- (* u -2.0) t1)))
double code(double u, double v, double t1) {
return v / ((u * -2.0) - 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 * (-2.0d0)) - t1)
end function
public static double code(double u, double v, double t1) {
return v / ((u * -2.0) - t1);
}
def code(u, v, t1): return v / ((u * -2.0) - t1)
function code(u, v, t1) return Float64(v / Float64(Float64(u * -2.0) - t1)) end
function tmp = code(u, v, t1) tmp = v / ((u * -2.0) - t1); end
code[u_, v_, t1_] := N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u \cdot -2 - t1}
\end{array}
Initial program 67.0%
associate-/r*78.4%
*-commutative78.4%
associate-/l*98.3%
associate-/l/94.4%
+-commutative94.4%
remove-double-neg94.4%
unsub-neg94.4%
div-sub94.4%
sub-neg94.4%
*-inverses94.4%
metadata-eval94.4%
Simplified94.4%
Taylor expanded in t1 around inf 61.1%
mul-1-neg61.1%
unsub-neg61.1%
*-commutative61.1%
Simplified61.1%
Final simplification61.1%
(FPCore (u v t1) :precision binary64 (if (<= u -4.3e+151) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (u <= -4.3e+151) {
tmp = v / 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 <= (-4.3d+151)) then
tmp = v / 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 <= -4.3e+151) {
tmp = v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -4.3e+151: tmp = v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -4.3e+151) tmp = Float64(v / u); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -4.3e+151) tmp = v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -4.3e+151], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -4.3 \cdot 10^{+151}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -4.29999999999999983e151Initial program 61.8%
times-frac97.8%
Simplified97.8%
Taylor expanded in t1 around 0 94.8%
associate-*r/94.8%
mul-1-neg94.8%
Simplified94.8%
associate-*r/94.8%
frac-2neg94.8%
div-inv94.8%
div-inv94.8%
add-sqr-sqrt48.2%
sqrt-unprod66.1%
sqr-neg66.1%
sqrt-unprod30.8%
add-sqr-sqrt61.6%
distribute-lft-neg-out61.6%
distribute-frac-neg61.6%
*-commutative61.6%
add-sqr-sqrt30.8%
sqrt-unprod66.5%
sqr-neg66.5%
sqrt-unprod46.4%
add-sqr-sqrt94.8%
distribute-neg-in94.8%
Applied egg-rr94.7%
Taylor expanded in t1 around inf 45.5%
if -4.29999999999999983e151 < u Initial program 67.9%
times-frac99.0%
Simplified99.0%
Taylor expanded in t1 around inf 59.7%
associate-*r/59.7%
neg-mul-159.7%
Simplified59.7%
Final simplification57.7%
(FPCore (u v t1) :precision binary64 (if (<= u -3.5e+148) (/ (- v) u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (u <= -3.5e+148) {
tmp = -v / 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 <= (-3.5d+148)) then
tmp = -v / 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 <= -3.5e+148) {
tmp = -v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -3.5e+148: tmp = -v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -3.5e+148) tmp = Float64(Float64(-v) / u); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -3.5e+148) tmp = -v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -3.5e+148], N[((-v) / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.5 \cdot 10^{+148}:\\
\;\;\;\;\frac{-v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -3.4999999999999999e148Initial program 62.8%
times-frac97.8%
Simplified97.8%
Taylor expanded in t1 around 0 94.9%
associate-*r/94.9%
mul-1-neg94.9%
Simplified94.9%
Taylor expanded in t1 around inf 44.6%
associate-*r/44.6%
neg-mul-144.6%
Simplified44.6%
if -3.4999999999999999e148 < u Initial program 67.8%
times-frac99.0%
Simplified99.0%
Taylor expanded in t1 around inf 60.0%
associate-*r/60.0%
neg-mul-160.0%
Simplified60.0%
Final simplification57.7%
(FPCore (u v t1) :precision binary64 (/ v t1))
double code(double u, double v, double t1) {
return v / t1;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = v / t1
end function
public static double code(double u, double v, double t1) {
return v / t1;
}
def code(u, v, t1): return v / t1
function code(u, v, t1) return Float64(v / 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 67.0%
times-frac98.8%
Simplified98.8%
Taylor expanded in t1 around inf 55.1%
Taylor expanded in u around inf 14.9%
Final simplification14.9%
herbie shell --seed 2024010
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))