
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
(FPCore (u v t1) :precision binary64 (* (/ (- t1) (+ t1 u)) (/ v (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 / (t1 + u)) * (v / (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 / (t1 + u)) * (v / (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 / (t1 + u)) * (v / (t1 + u));
}
def code(u, v, t1): return (-t1 / (t1 + u)) * (v / (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) / Float64(t1 + u)) * 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 69.7%
times-frac98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* (/ (- v) (+ t1 u)) (/ t1 u))))
(if (<= u -2.5e-16)
t_1
(if (<= u -1.46e-120)
(/ v (- (* u -2.0) t1))
(if (<= u -8.5e-143)
(/ v (* u (/ (- u) t1)))
(if (<= u 1.9e-76) (/ (- v) t1) t_1))))))
double code(double u, double v, double t1) {
double t_1 = (-v / (t1 + u)) * (t1 / u);
double tmp;
if (u <= -2.5e-16) {
tmp = t_1;
} else if (u <= -1.46e-120) {
tmp = v / ((u * -2.0) - t1);
} else if (u <= -8.5e-143) {
tmp = v / (u * (-u / t1));
} else if (u <= 1.9e-76) {
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 = (-v / (t1 + u)) * (t1 / u)
if (u <= (-2.5d-16)) then
tmp = t_1
else if (u <= (-1.46d-120)) then
tmp = v / ((u * (-2.0d0)) - t1)
else if (u <= (-8.5d-143)) then
tmp = v / (u * (-u / t1))
else if (u <= 1.9d-76) 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 = (-v / (t1 + u)) * (t1 / u);
double tmp;
if (u <= -2.5e-16) {
tmp = t_1;
} else if (u <= -1.46e-120) {
tmp = v / ((u * -2.0) - t1);
} else if (u <= -8.5e-143) {
tmp = v / (u * (-u / t1));
} else if (u <= 1.9e-76) {
tmp = -v / t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = (-v / (t1 + u)) * (t1 / u) tmp = 0 if u <= -2.5e-16: tmp = t_1 elif u <= -1.46e-120: tmp = v / ((u * -2.0) - t1) elif u <= -8.5e-143: tmp = v / (u * (-u / t1)) elif u <= 1.9e-76: tmp = -v / t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(Float64(-v) / Float64(t1 + u)) * Float64(t1 / u)) tmp = 0.0 if (u <= -2.5e-16) tmp = t_1; elseif (u <= -1.46e-120) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); elseif (u <= -8.5e-143) tmp = Float64(v / Float64(u * Float64(Float64(-u) / t1))); elseif (u <= 1.9e-76) tmp = Float64(Float64(-v) / t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = (-v / (t1 + u)) * (t1 / u); tmp = 0.0; if (u <= -2.5e-16) tmp = t_1; elseif (u <= -1.46e-120) tmp = v / ((u * -2.0) - t1); elseif (u <= -8.5e-143) tmp = v / (u * (-u / t1)); elseif (u <= 1.9e-76) tmp = -v / t1; 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] * N[(t1 / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -2.5e-16], t$95$1, If[LessEqual[u, -1.46e-120], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, -8.5e-143], N[(v / N[(u * N[((-u) / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 1.9e-76], N[((-v) / t1), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u} \cdot \frac{t1}{u}\\
\mathbf{if}\;u \leq -2.5 \cdot 10^{-16}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;u \leq -1.46 \cdot 10^{-120}:\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{elif}\;u \leq -8.5 \cdot 10^{-143}:\\
\;\;\;\;\frac{v}{u \cdot \frac{-u}{t1}}\\
\mathbf{elif}\;u \leq 1.9 \cdot 10^{-76}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if u < -2.5000000000000002e-16 or 1.9000000000000001e-76 < u Initial program 75.5%
times-frac98.1%
Simplified98.1%
Taylor expanded in t1 around 0 81.1%
associate-*r/76.7%
mul-1-neg76.7%
Simplified81.1%
if -2.5000000000000002e-16 < u < -1.4599999999999999e-120Initial program 79.3%
associate-/r*83.5%
*-commutative83.5%
associate-/l*95.7%
associate-/l/99.8%
+-commutative99.8%
remove-double-neg99.8%
unsub-neg99.8%
div-sub99.8%
sub-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t1 around inf 74.8%
mul-1-neg74.8%
unsub-neg74.8%
*-commutative74.8%
Simplified74.8%
if -1.4599999999999999e-120 < u < -8.50000000000000072e-143Initial program 62.6%
times-frac80.7%
Simplified80.7%
Taylor expanded in t1 around 0 80.7%
*-commutative80.7%
frac-2neg80.7%
associate-*l/74.0%
Applied egg-rr74.0%
associate-/l/99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
neg-sub099.7%
associate--r+99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in u around inf 99.7%
associate-*r/99.7%
neg-mul-199.7%
Simplified99.7%
if -8.50000000000000072e-143 < u < 1.9000000000000001e-76Initial program 57.8%
times-frac98.9%
Simplified98.9%
Taylor expanded in t1 around inf 87.4%
associate-*r/87.4%
neg-mul-187.4%
Simplified87.4%
Final simplification83.0%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -8.2e-59) (not (<= t1 185.0))) (/ v (- (* u -2.0) t1)) (* (/ (- t1) u) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -8.2e-59) || !(t1 <= 185.0)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-t1 / u) * (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 <= (-8.2d-59)) .or. (.not. (t1 <= 185.0d0))) then
tmp = v / ((u * (-2.0d0)) - t1)
else
tmp = (-t1 / u) * (v / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -8.2e-59) || !(t1 <= 185.0)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-t1 / u) * (v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -8.2e-59) or not (t1 <= 185.0): tmp = v / ((u * -2.0) - t1) else: tmp = (-t1 / u) * (v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -8.2e-59) || !(t1 <= 185.0)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(Float64(Float64(-t1) / u) * Float64(v / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -8.2e-59) || ~((t1 <= 185.0))) tmp = v / ((u * -2.0) - t1); else tmp = (-t1 / u) * (v / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -8.2e-59], N[Not[LessEqual[t1, 185.0]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) / u), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -8.2 \cdot 10^{-59} \lor \neg \left(t1 \leq 185\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u}\\
\end{array}
\end{array}
if t1 < -8.1999999999999991e-59 or 185 < t1 Initial program 58.3%
associate-/r*75.4%
*-commutative75.4%
associate-/l*99.9%
associate-/l/94.0%
+-commutative94.0%
remove-double-neg94.0%
unsub-neg94.0%
div-sub94.0%
sub-neg94.0%
*-inverses94.0%
metadata-eval94.0%
Simplified94.0%
Taylor expanded in t1 around inf 81.1%
mul-1-neg81.1%
unsub-neg81.1%
*-commutative81.1%
Simplified81.1%
if -8.1999999999999991e-59 < t1 < 185Initial program 80.9%
times-frac96.4%
Simplified96.4%
Taylor expanded in t1 around 0 75.6%
Taylor expanded in t1 around 0 78.4%
associate-*r/78.4%
mul-1-neg78.4%
Simplified78.4%
Final simplification79.8%
(FPCore (u v t1) :precision binary64 (if (<= u -2.5e+45) (* (/ (- v) (+ t1 u)) (/ t1 u)) (/ v (* (+ t1 u) (- -1.0 (/ u t1))))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -2.5e+45) {
tmp = (-v / (t1 + u)) * (t1 / u);
} else {
tmp = v / ((t1 + u) * (-1.0 - (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 <= (-2.5d+45)) then
tmp = (-v / (t1 + u)) * (t1 / u)
else
tmp = v / ((t1 + u) * ((-1.0d0) - (u / t1)))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -2.5e+45) {
tmp = (-v / (t1 + u)) * (t1 / u);
} else {
tmp = v / ((t1 + u) * (-1.0 - (u / t1)));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -2.5e+45: tmp = (-v / (t1 + u)) * (t1 / u) else: tmp = v / ((t1 + u) * (-1.0 - (u / t1))) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -2.5e+45) tmp = Float64(Float64(Float64(-v) / Float64(t1 + u)) * Float64(t1 / u)); else tmp = Float64(v / Float64(Float64(t1 + u) * Float64(-1.0 - Float64(u / t1)))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -2.5e+45) tmp = (-v / (t1 + u)) * (t1 / u); else tmp = v / ((t1 + u) * (-1.0 - (u / t1))); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -2.5e+45], N[(N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], N[(v / N[(N[(t1 + u), $MachinePrecision] * N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.5 \cdot 10^{+45}:\\
\;\;\;\;\frac{-v}{t1 + u} \cdot \frac{t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}\\
\end{array}
\end{array}
if u < -2.5e45Initial program 78.1%
times-frac98.6%
Simplified98.6%
Taylor expanded in t1 around 0 94.7%
associate-*r/88.8%
mul-1-neg88.8%
Simplified94.7%
if -2.5e45 < u Initial program 67.8%
associate-/r*78.6%
*-commutative78.6%
associate-/l*96.6%
associate-/l/97.1%
+-commutative97.1%
remove-double-neg97.1%
unsub-neg97.1%
div-sub97.1%
sub-neg97.1%
*-inverses97.1%
metadata-eval97.1%
Simplified97.1%
Taylor expanded in u around 0 97.1%
sub-neg97.1%
mul-1-neg97.1%
distribute-neg-in97.1%
+-commutative97.1%
distribute-neg-in97.1%
metadata-eval97.1%
sub-neg97.1%
Simplified97.1%
Final simplification96.7%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.85e+92) (not (<= u 1.8e+139))) (/ v (+ t1 u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.85e+92) || !(u <= 1.8e+139)) {
tmp = v / (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.85d+92)) .or. (.not. (u <= 1.8d+139))) then
tmp = v / (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.85e+92) || !(u <= 1.8e+139)) {
tmp = v / (t1 + u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.85e+92) or not (u <= 1.8e+139): tmp = v / (t1 + u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.85e+92) || !(u <= 1.8e+139)) tmp = Float64(v / 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.85e+92) || ~((u <= 1.8e+139))) tmp = v / (t1 + u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.85e+92], N[Not[LessEqual[u, 1.8e+139]], $MachinePrecision]], N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.85 \cdot 10^{+92} \lor \neg \left(u \leq 1.8 \cdot 10^{+139}\right):\\
\;\;\;\;\frac{v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -1.84999999999999999e92 or 1.79999999999999993e139 < u Initial program 76.5%
times-frac99.0%
Simplified99.0%
associate-*r/99.0%
clear-num99.0%
associate-*l/99.0%
*-un-lft-identity99.0%
frac-2neg99.0%
distribute-neg-in99.0%
add-sqr-sqrt50.5%
sqrt-unprod90.2%
sqr-neg90.2%
sqrt-unprod48.5%
add-sqr-sqrt97.8%
sub-neg97.8%
remove-double-neg97.8%
Applied egg-rr97.8%
Taylor expanded in t1 around inf 45.1%
if -1.84999999999999999e92 < u < 1.79999999999999993e139Initial program 67.2%
times-frac97.9%
Simplified97.9%
Taylor expanded in t1 around inf 62.4%
associate-*r/62.4%
neg-mul-162.4%
Simplified62.4%
Final simplification57.8%
(FPCore (u v t1) :precision binary64 (if (or (<= u -5e+91) (not (<= u 1.6e+158))) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -5e+91) || !(u <= 1.6e+158)) {
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 <= (-5d+91)) .or. (.not. (u <= 1.6d+158))) 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 <= -5e+91) || !(u <= 1.6e+158)) {
tmp = v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -5e+91) or not (u <= 1.6e+158): tmp = v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -5e+91) || !(u <= 1.6e+158)) 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 <= -5e+91) || ~((u <= 1.6e+158))) tmp = v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -5e+91], N[Not[LessEqual[u, 1.6e+158]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -5 \cdot 10^{+91} \lor \neg \left(u \leq 1.6 \cdot 10^{+158}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -5.0000000000000002e91 or 1.59999999999999997e158 < u Initial program 75.4%
times-frac99.0%
Simplified99.0%
*-commutative99.0%
clear-num98.0%
frac-2neg98.0%
frac-times90.8%
*-un-lft-identity90.8%
remove-double-neg90.8%
distribute-neg-in90.8%
add-sqr-sqrt44.6%
sqrt-unprod84.9%
sqr-neg84.9%
sqrt-unprod46.2%
add-sqr-sqrt90.8%
sub-neg90.8%
Applied egg-rr90.8%
Taylor expanded in t1 around 0 90.8%
Taylor expanded in t1 around inf 40.8%
if -5.0000000000000002e91 < u < 1.59999999999999997e158Initial program 67.8%
times-frac97.9%
Simplified97.9%
Taylor expanded in t1 around inf 62.5%
associate-*r/62.5%
neg-mul-162.5%
Simplified62.5%
Final simplification57.0%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -8e+89) (not (<= t1 1.45e+169))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -8e+89) || !(t1 <= 1.45e+169)) {
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 <= (-8d+89)) .or. (.not. (t1 <= 1.45d+169))) 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 <= -8e+89) || !(t1 <= 1.45e+169)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -8e+89) or not (t1 <= 1.45e+169): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -8e+89) || !(t1 <= 1.45e+169)) 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 <= -8e+89) || ~((t1 <= 1.45e+169))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -8e+89], N[Not[LessEqual[t1, 1.45e+169]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -8 \cdot 10^{+89} \lor \neg \left(t1 \leq 1.45 \cdot 10^{+169}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -7.99999999999999996e89 or 1.45e169 < t1 Initial program 47.6%
times-frac100.0%
Simplified100.0%
*-commutative100.0%
clear-num98.8%
frac-2neg98.8%
frac-times65.1%
*-un-lft-identity65.1%
remove-double-neg65.1%
distribute-neg-in65.1%
add-sqr-sqrt36.3%
sqrt-unprod50.3%
sqr-neg50.3%
sqrt-unprod23.2%
add-sqr-sqrt45.9%
sub-neg45.9%
Applied egg-rr45.9%
Taylor expanded in t1 around inf 36.5%
if -7.99999999999999996e89 < t1 < 1.45e169Initial program 78.2%
times-frac97.5%
Simplified97.5%
*-commutative97.5%
clear-num97.3%
frac-2neg97.3%
frac-times91.6%
*-un-lft-identity91.6%
remove-double-neg91.6%
distribute-neg-in91.6%
add-sqr-sqrt49.5%
sqrt-unprod75.6%
sqr-neg75.6%
sqrt-unprod27.4%
add-sqr-sqrt59.5%
sub-neg59.5%
Applied egg-rr59.5%
Taylor expanded in t1 around 0 61.9%
Taylor expanded in t1 around inf 16.4%
Final simplification22.0%
(FPCore (u v t1) :precision binary64 (/ (/ v (+ t1 u)) (- -1.0 (/ u t1))))
double code(double u, double v, double t1) {
return (v / (t1 + u)) / (-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 / (t1 + u)) / ((-1.0d0) - (u / t1))
end function
public static double code(double u, double v, double t1) {
return (v / (t1 + u)) / (-1.0 - (u / t1));
}
def code(u, v, t1): return (v / (t1 + u)) / (-1.0 - (u / t1))
function code(u, v, t1) return Float64(Float64(v / Float64(t1 + u)) / Float64(-1.0 - Float64(u / t1))) end
function tmp = code(u, v, t1) tmp = (v / (t1 + u)) / (-1.0 - (u / t1)); end
code[u_, v_, t1_] := N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{t1 + u}}{-1 - \frac{u}{t1}}
\end{array}
Initial program 69.7%
associate-/r*80.0%
*-commutative80.0%
associate-/l*96.9%
associate-/l/94.5%
+-commutative94.5%
remove-double-neg94.5%
unsub-neg94.5%
div-sub94.5%
sub-neg94.5%
*-inverses94.5%
metadata-eval94.5%
Simplified94.5%
Taylor expanded in v around 0 94.5%
sub-neg94.5%
mul-1-neg94.5%
distribute-neg-in94.5%
associate-/r*98.1%
+-commutative98.1%
distribute-neg-in98.1%
metadata-eval98.1%
sub-neg98.1%
Simplified98.1%
Final simplification98.1%
(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 69.7%
associate-/r*80.0%
*-commutative80.0%
associate-/l*96.9%
associate-/l/94.5%
+-commutative94.5%
remove-double-neg94.5%
unsub-neg94.5%
div-sub94.5%
sub-neg94.5%
*-inverses94.5%
metadata-eval94.5%
Simplified94.5%
Taylor expanded in t1 around inf 58.5%
mul-1-neg58.5%
unsub-neg58.5%
*-commutative58.5%
Simplified58.5%
Final simplification58.5%
(FPCore (u v t1) :precision binary64 (/ (- v) (+ t1 u)))
double code(double u, double v, double t1) {
return -v / (t1 + u);
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / (t1 + u)
end function
public static double code(double u, double v, double t1) {
return -v / (t1 + u);
}
def code(u, v, t1): return -v / (t1 + u)
function code(u, v, t1) return Float64(Float64(-v) / Float64(t1 + u)) end
function tmp = code(u, v, t1) tmp = -v / (t1 + u); end
code[u_, v_, t1_] := N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{t1 + u}
\end{array}
Initial program 69.7%
times-frac98.2%
Simplified98.2%
associate-*r/96.9%
clear-num96.9%
associate-*l/96.9%
*-un-lft-identity96.9%
frac-2neg96.9%
distribute-neg-in96.9%
add-sqr-sqrt53.9%
sqrt-unprod71.6%
sqr-neg71.6%
sqrt-unprod27.1%
add-sqr-sqrt56.8%
sub-neg56.8%
remove-double-neg56.8%
Applied egg-rr56.8%
associate-/r/57.1%
add-sqr-sqrt26.4%
sqrt-unprod43.1%
sqr-neg43.1%
sqrt-unprod38.5%
add-sqr-sqrt69.9%
distribute-rgt-neg-in69.9%
associate-/r/69.9%
neg-sub069.9%
div-sub69.9%
*-inverses69.9%
sub-neg69.9%
distribute-neg-frac69.9%
add-sqr-sqrt31.2%
sqrt-unprod75.6%
sqr-neg75.6%
sqrt-unprod54.0%
add-sqr-sqrt96.9%
frac-2neg96.9%
Applied egg-rr96.9%
neg-sub096.9%
distribute-neg-frac96.9%
Simplified96.9%
Taylor expanded in u around 0 58.1%
mul-1-neg58.1%
Simplified58.1%
Final simplification58.1%
(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 69.7%
times-frac98.2%
Simplified98.2%
*-commutative98.2%
clear-num97.7%
frac-2neg97.7%
frac-times84.3%
*-un-lft-identity84.3%
remove-double-neg84.3%
distribute-neg-in84.3%
add-sqr-sqrt45.8%
sqrt-unprod68.6%
sqr-neg68.6%
sqrt-unprod26.2%
add-sqr-sqrt55.7%
sub-neg55.7%
Applied egg-rr55.7%
Taylor expanded in t1 around inf 12.6%
Final simplification12.6%
herbie shell --seed 2024023
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))