
(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 (/ (/ (- v) (+ 1.0 (/ u t1))) (+ u t1)))
double code(double u, double v, double t1) {
return (-v / (1.0 + (u / t1))) / (u + t1);
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-v / (1.0d0 + (u / t1))) / (u + t1)
end function
public static double code(double u, double v, double t1) {
return (-v / (1.0 + (u / t1))) / (u + t1);
}
def code(u, v, t1): return (-v / (1.0 + (u / t1))) / (u + t1)
function code(u, v, t1) return Float64(Float64(Float64(-v) / Float64(1.0 + Float64(u / t1))) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = (-v / (1.0 + (u / t1))) / (u + t1); end
code[u_, v_, t1_] := N[(N[((-v) / N[(1.0 + N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{-v}{1 + \frac{u}{t1}}}{u + t1}
\end{array}
Initial program 71.6%
*-commutative71.6%
times-frac98.2%
neg-mul-198.2%
associate-/l*98.2%
associate-*r/98.2%
associate-/l*98.2%
associate-/l/98.2%
neg-mul-198.2%
*-lft-identity98.2%
metadata-eval98.2%
times-frac98.2%
neg-mul-198.2%
remove-double-neg98.2%
neg-mul-198.2%
sub0-neg98.2%
associate--r+98.2%
neg-sub098.2%
div-sub98.3%
distribute-frac-neg98.3%
*-inverses98.3%
metadata-eval98.3%
Simplified98.3%
div-inv98.1%
Applied egg-rr98.1%
Taylor expanded in v around 0 96.8%
associate-*r/96.8%
*-commutative96.8%
times-frac98.2%
associate-*l/99.7%
associate-*r/99.7%
*-commutative99.7%
neg-mul-199.7%
Simplified99.7%
Final simplification99.7%
(FPCore (u v t1)
:precision binary64
(if (or (<= u -4.9e-6)
(not (or (<= u 7.6e-87) (and (not (<= u 3.4e+34)) (<= u 4.5e+54)))))
(* t1 (/ (- v) (* u u)))
(/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -4.9e-6) || !((u <= 7.6e-87) || (!(u <= 3.4e+34) && (u <= 4.5e+54)))) {
tmp = t1 * (-v / (u * 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.9d-6)) .or. (.not. (u <= 7.6d-87) .or. (.not. (u <= 3.4d+34)) .and. (u <= 4.5d+54))) then
tmp = t1 * (-v / (u * 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.9e-6) || !((u <= 7.6e-87) || (!(u <= 3.4e+34) && (u <= 4.5e+54)))) {
tmp = t1 * (-v / (u * u));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -4.9e-6) or not ((u <= 7.6e-87) or (not (u <= 3.4e+34) and (u <= 4.5e+54))): tmp = t1 * (-v / (u * u)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -4.9e-6) || !((u <= 7.6e-87) || (!(u <= 3.4e+34) && (u <= 4.5e+54)))) tmp = Float64(t1 * Float64(Float64(-v) / Float64(u * u))); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -4.9e-6) || ~(((u <= 7.6e-87) || (~((u <= 3.4e+34)) && (u <= 4.5e+54))))) tmp = t1 * (-v / (u * u)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -4.9e-6], N[Not[Or[LessEqual[u, 7.6e-87], And[N[Not[LessEqual[u, 3.4e+34]], $MachinePrecision], LessEqual[u, 4.5e+54]]]], $MachinePrecision]], N[(t1 * N[((-v) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -4.9 \cdot 10^{-6} \lor \neg \left(u \leq 7.6 \cdot 10^{-87} \lor \neg \left(u \leq 3.4 \cdot 10^{+34}\right) \land u \leq 4.5 \cdot 10^{+54}\right):\\
\;\;\;\;t1 \cdot \frac{-v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -4.89999999999999967e-6 or 7.6e-87 < u < 3.3999999999999999e34 or 4.49999999999999984e54 < u Initial program 80.4%
distribute-lft-neg-out80.4%
distribute-rgt-neg-in80.4%
associate-*r/81.8%
neg-mul-181.8%
*-commutative81.8%
associate-/l*81.8%
*-rgt-identity81.8%
associate-*r/81.8%
*-inverses81.8%
associate-*r*81.8%
times-frac81.8%
*-commutative81.8%
neg-mul-181.8%
associate-/l*81.6%
associate-/r/81.8%
neg-mul-181.8%
*-commutative81.8%
associate-/r*81.8%
*-inverses81.8%
metadata-eval81.8%
neg-mul-181.8%
distribute-neg-in81.8%
sub-neg81.8%
Simplified81.8%
Taylor expanded in t1 around 0 75.0%
associate-*r/75.0%
neg-mul-175.0%
unpow275.0%
Simplified75.0%
if -4.89999999999999967e-6 < u < 7.6e-87 or 3.3999999999999999e34 < u < 4.49999999999999984e54Initial program 61.7%
*-commutative61.7%
times-frac97.5%
neg-mul-197.5%
associate-/l*97.6%
associate-*r/97.6%
associate-/l*97.6%
associate-/l/97.6%
neg-mul-197.6%
*-lft-identity97.6%
metadata-eval97.6%
times-frac97.6%
neg-mul-197.6%
remove-double-neg97.6%
neg-mul-197.6%
sub0-neg97.6%
associate--r+97.6%
neg-sub097.6%
div-sub97.6%
distribute-frac-neg97.6%
*-inverses97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in t1 around inf 83.1%
mul-1-neg83.1%
Simplified83.1%
Final simplification78.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5e+23) (not (<= t1 5.2e+84))) (/ (- v) t1) (* (/ v u) (/ (- t1) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5e+23) || !(t1 <= 5.2e+84)) {
tmp = -v / t1;
} else {
tmp = (v / 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 <= (-5d+23)) .or. (.not. (t1 <= 5.2d+84))) then
tmp = -v / t1
else
tmp = (v / u) * (-t1 / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5e+23) || !(t1 <= 5.2e+84)) {
tmp = -v / t1;
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5e+23) or not (t1 <= 5.2e+84): tmp = -v / t1 else: tmp = (v / u) * (-t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5e+23) || !(t1 <= 5.2e+84)) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(v / u) * Float64(Float64(-t1) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -5e+23) || ~((t1 <= 5.2e+84))) tmp = -v / t1; else tmp = (v / u) * (-t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -5e+23], N[Not[LessEqual[t1, 5.2e+84]], $MachinePrecision]], N[((-v) / t1), $MachinePrecision], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5 \cdot 10^{+23} \lor \neg \left(t1 \leq 5.2 \cdot 10^{+84}\right):\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\end{array}
\end{array}
if t1 < -4.9999999999999999e23 or 5.2000000000000002e84 < t1 Initial program 54.7%
*-commutative54.7%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/99.9%
associate-/l*99.9%
associate-/l/99.9%
neg-mul-199.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub0-neg99.9%
associate--r+99.9%
neg-sub099.9%
div-sub99.9%
distribute-frac-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t1 around inf 87.4%
mul-1-neg87.4%
Simplified87.4%
if -4.9999999999999999e23 < t1 < 5.2000000000000002e84Initial program 82.8%
associate-/l*82.7%
Simplified82.7%
associate-/l*91.5%
div-inv91.4%
clear-num91.5%
Applied egg-rr91.5%
Taylor expanded in t1 around 0 69.8%
Taylor expanded in t1 around 0 66.1%
unpow266.1%
associate-/l*71.3%
Simplified71.3%
neg-mul-171.3%
associate-/r/71.3%
times-frac73.7%
metadata-eval73.7%
distribute-neg-frac73.7%
clear-num73.6%
distribute-neg-frac73.6%
Applied egg-rr73.6%
Final simplification79.1%
(FPCore (u v t1) :precision binary64 (if (<= t1 -2.4e-32) (/ -1.0 (/ (+ u t1) v)) (if (<= t1 5.1e+84) (* (/ v u) (/ (- t1) u)) (/ (- v) t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.4e-32) {
tmp = -1.0 / ((u + t1) / v);
} else if (t1 <= 5.1e+84) {
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 (t1 <= (-2.4d-32)) then
tmp = (-1.0d0) / ((u + t1) / v)
else if (t1 <= 5.1d+84) 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 (t1 <= -2.4e-32) {
tmp = -1.0 / ((u + t1) / v);
} else if (t1 <= 5.1e+84) {
tmp = (v / u) * (-t1 / u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -2.4e-32: tmp = -1.0 / ((u + t1) / v) elif t1 <= 5.1e+84: tmp = (v / u) * (-t1 / u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -2.4e-32) tmp = Float64(-1.0 / Float64(Float64(u + t1) / v)); elseif (t1 <= 5.1e+84) tmp = Float64(Float64(v / 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 (t1 <= -2.4e-32) tmp = -1.0 / ((u + t1) / v); elseif (t1 <= 5.1e+84) tmp = (v / u) * (-t1 / u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -2.4e-32], N[(-1.0 / N[(N[(u + t1), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 5.1e+84], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.4 \cdot 10^{-32}:\\
\;\;\;\;\frac{-1}{\frac{u + t1}{v}}\\
\mathbf{elif}\;t1 \leq 5.1 \cdot 10^{+84}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -2.4000000000000001e-32Initial program 66.4%
associate-/l*67.4%
Simplified67.4%
associate-/l*79.5%
div-inv79.4%
clear-num79.3%
Applied egg-rr79.3%
neg-mul-179.3%
*-commutative79.3%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.7%
mul-1-neg99.7%
Simplified99.7%
Taylor expanded in t1 around inf 86.5%
if -2.4000000000000001e-32 < t1 < 5.1000000000000001e84Initial program 81.2%
associate-/l*81.7%
Simplified81.7%
associate-/l*91.4%
div-inv91.3%
clear-num91.3%
Applied egg-rr91.3%
Taylor expanded in t1 around 0 71.8%
Taylor expanded in t1 around 0 67.8%
unpow267.8%
associate-/l*73.4%
Simplified73.4%
neg-mul-173.4%
associate-/r/73.4%
times-frac75.5%
metadata-eval75.5%
distribute-neg-frac75.5%
clear-num75.5%
distribute-neg-frac75.5%
Applied egg-rr75.5%
if 5.1000000000000001e84 < t1 Initial program 48.6%
*-commutative48.6%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/99.9%
associate-/l*99.9%
associate-/l/99.9%
neg-mul-199.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub0-neg99.9%
associate--r+99.9%
neg-sub099.9%
div-sub99.9%
distribute-frac-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t1 around inf 94.4%
mul-1-neg94.4%
Simplified94.4%
Final simplification81.8%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.15e-34) (/ -1.0 (/ (+ u t1) v)) (if (<= t1 1.05e+85) (/ (* t1 (/ v u)) (- u)) (/ (- v) t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.15e-34) {
tmp = -1.0 / ((u + t1) / v);
} else if (t1 <= 1.05e+85) {
tmp = (t1 * (v / u)) / -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 (t1 <= (-1.15d-34)) then
tmp = (-1.0d0) / ((u + t1) / v)
else if (t1 <= 1.05d+85) then
tmp = (t1 * (v / u)) / -u
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.15e-34) {
tmp = -1.0 / ((u + t1) / v);
} else if (t1 <= 1.05e+85) {
tmp = (t1 * (v / u)) / -u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.15e-34: tmp = -1.0 / ((u + t1) / v) elif t1 <= 1.05e+85: tmp = (t1 * (v / u)) / -u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.15e-34) tmp = Float64(-1.0 / Float64(Float64(u + t1) / v)); elseif (t1 <= 1.05e+85) tmp = Float64(Float64(t1 * Float64(v / u)) / Float64(-u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.15e-34) tmp = -1.0 / ((u + t1) / v); elseif (t1 <= 1.05e+85) tmp = (t1 * (v / u)) / -u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.15e-34], N[(-1.0 / N[(N[(u + t1), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.05e+85], N[(N[(t1 * N[(v / u), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.15 \cdot 10^{-34}:\\
\;\;\;\;\frac{-1}{\frac{u + t1}{v}}\\
\mathbf{elif}\;t1 \leq 1.05 \cdot 10^{+85}:\\
\;\;\;\;\frac{t1 \cdot \frac{v}{u}}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -1.15000000000000006e-34Initial program 66.4%
associate-/l*67.4%
Simplified67.4%
associate-/l*79.5%
div-inv79.4%
clear-num79.3%
Applied egg-rr79.3%
neg-mul-179.3%
*-commutative79.3%
times-frac99.7%
+-commutative99.7%
+-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.7%
mul-1-neg99.7%
Simplified99.7%
Taylor expanded in t1 around inf 86.5%
if -1.15000000000000006e-34 < t1 < 1.05000000000000005e85Initial program 81.2%
Taylor expanded in t1 around 0 67.9%
unpow267.9%
Simplified67.9%
*-commutative67.9%
times-frac75.5%
add-sqr-sqrt29.8%
sqrt-unprod51.2%
sqr-neg51.2%
sqrt-unprod28.1%
add-sqr-sqrt42.4%
Applied egg-rr42.4%
*-commutative42.4%
frac-2neg42.4%
associate-*l/42.4%
add-sqr-sqrt14.3%
sqrt-unprod49.4%
sqr-neg49.4%
sqrt-unprod45.6%
add-sqr-sqrt75.9%
Applied egg-rr75.9%
if 1.05000000000000005e85 < t1 Initial program 48.6%
*-commutative48.6%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/99.9%
associate-/l*99.9%
associate-/l/99.9%
neg-mul-199.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub0-neg99.9%
associate--r+99.9%
neg-sub099.9%
div-sub99.9%
distribute-frac-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t1 around inf 94.4%
mul-1-neg94.4%
Simplified94.4%
Final simplification82.0%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.15e-83) (/ (/ v t1) (- -1.0 (/ u t1))) (if (<= t1 7.2e+84) (/ (* t1 (/ v u)) (- u)) (/ (- v) t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.15e-83) {
tmp = (v / t1) / (-1.0 - (u / t1));
} else if (t1 <= 7.2e+84) {
tmp = (t1 * (v / u)) / -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 (t1 <= (-1.15d-83)) then
tmp = (v / t1) / ((-1.0d0) - (u / t1))
else if (t1 <= 7.2d+84) then
tmp = (t1 * (v / u)) / -u
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.15e-83) {
tmp = (v / t1) / (-1.0 - (u / t1));
} else if (t1 <= 7.2e+84) {
tmp = (t1 * (v / u)) / -u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.15e-83: tmp = (v / t1) / (-1.0 - (u / t1)) elif t1 <= 7.2e+84: tmp = (t1 * (v / u)) / -u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.15e-83) tmp = Float64(Float64(v / t1) / Float64(-1.0 - Float64(u / t1))); elseif (t1 <= 7.2e+84) tmp = Float64(Float64(t1 * Float64(v / u)) / Float64(-u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.15e-83) tmp = (v / t1) / (-1.0 - (u / t1)); elseif (t1 <= 7.2e+84) tmp = (t1 * (v / u)) / -u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.15e-83], N[(N[(v / t1), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 7.2e+84], N[(N[(t1 * N[(v / u), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.15 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{v}{t1}}{-1 - \frac{u}{t1}}\\
\mathbf{elif}\;t1 \leq 7.2 \cdot 10^{+84}:\\
\;\;\;\;\frac{t1 \cdot \frac{v}{u}}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if t1 < -1.14999999999999995e-83Initial program 69.0%
*-commutative69.0%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/99.9%
associate-/l*99.9%
associate-/l/99.9%
neg-mul-199.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub0-neg99.9%
associate--r+99.9%
neg-sub099.9%
div-sub100.0%
distribute-frac-neg100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t1 around inf 84.1%
if -1.14999999999999995e-83 < t1 < 7.1999999999999999e84Initial program 80.4%
Taylor expanded in t1 around 0 68.6%
unpow268.6%
Simplified68.6%
*-commutative68.6%
times-frac76.5%
add-sqr-sqrt28.8%
sqrt-unprod51.2%
sqr-neg51.2%
sqrt-unprod29.3%
add-sqr-sqrt43.5%
Applied egg-rr43.5%
*-commutative43.5%
frac-2neg43.5%
associate-*l/43.5%
add-sqr-sqrt14.1%
sqrt-unprod50.8%
sqr-neg50.8%
sqrt-unprod47.7%
add-sqr-sqrt77.0%
Applied egg-rr77.0%
if 7.1999999999999999e84 < t1 Initial program 48.6%
*-commutative48.6%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/99.9%
associate-/l*99.9%
associate-/l/99.9%
neg-mul-199.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub0-neg99.9%
associate--r+99.9%
neg-sub099.9%
div-sub99.9%
distribute-frac-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t1 around inf 94.4%
mul-1-neg94.4%
Simplified94.4%
Final simplification82.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.05e+64) (not (<= u 9.5e+136))) (* t1 (/ v (* u u))) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.05e+64) || !(u <= 9.5e+136)) {
tmp = t1 * (v / (u * 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.05d+64)) .or. (.not. (u <= 9.5d+136))) then
tmp = t1 * (v / (u * 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.05e+64) || !(u <= 9.5e+136)) {
tmp = t1 * (v / (u * u));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.05e+64) or not (u <= 9.5e+136): tmp = t1 * (v / (u * u)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.05e+64) || !(u <= 9.5e+136)) tmp = Float64(t1 * Float64(v / Float64(u * u))); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.05e+64) || ~((u <= 9.5e+136))) tmp = t1 * (v / (u * u)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.05e+64], N[Not[LessEqual[u, 9.5e+136]], $MachinePrecision]], N[(t1 * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.05 \cdot 10^{+64} \lor \neg \left(u \leq 9.5 \cdot 10^{+136}\right):\\
\;\;\;\;t1 \cdot \frac{v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -1.05e64 or 9.49999999999999907e136 < u Initial program 83.3%
Taylor expanded in t1 around 0 83.4%
unpow283.4%
Simplified83.4%
expm1-log1p-u83.3%
expm1-udef74.5%
div-inv74.5%
associate-*l*74.8%
add-sqr-sqrt31.1%
sqrt-unprod64.2%
sqr-neg64.2%
sqrt-unprod42.5%
add-sqr-sqrt73.6%
pow273.6%
pow-flip73.6%
metadata-eval73.6%
Applied egg-rr73.6%
expm1-def73.4%
expm1-log1p73.5%
associate-*r*73.2%
*-commutative73.2%
metadata-eval73.2%
pow-sqr73.2%
unpow-173.2%
unpow-173.2%
associate-*l*70.8%
associate-*l/70.8%
associate-*r/70.8%
*-lft-identity70.8%
associate-*l/70.8%
*-lft-identity70.8%
associate-*r/72.1%
associate-*r/73.3%
associate-/r*73.5%
Simplified73.5%
if -1.05e64 < u < 9.49999999999999907e136Initial program 65.4%
*-commutative65.4%
times-frac97.6%
neg-mul-197.6%
associate-/l*97.6%
associate-*r/97.6%
associate-/l*97.6%
associate-/l/97.6%
neg-mul-197.6%
*-lft-identity97.6%
metadata-eval97.6%
times-frac97.6%
neg-mul-197.6%
remove-double-neg97.6%
neg-mul-197.6%
sub0-neg97.6%
associate--r+97.6%
neg-sub097.6%
div-sub97.6%
distribute-frac-neg97.6%
*-inverses97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in t1 around inf 71.6%
mul-1-neg71.6%
Simplified71.6%
Final simplification72.3%
(FPCore (u v t1) :precision binary64 (/ v (* (+ u t1) (- -1.0 (/ u t1)))))
double code(double u, double v, double t1) {
return v / ((u + t1) * (-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 / ((u + t1) * ((-1.0d0) - (u / t1)))
end function
public static double code(double u, double v, double t1) {
return v / ((u + t1) * (-1.0 - (u / t1)));
}
def code(u, v, t1): return v / ((u + t1) * (-1.0 - (u / t1)))
function code(u, v, t1) return Float64(v / Float64(Float64(u + t1) * Float64(-1.0 - Float64(u / t1)))) end
function tmp = code(u, v, t1) tmp = v / ((u + t1) * (-1.0 - (u / t1))); end
code[u_, v_, t1_] := N[(v / N[(N[(u + t1), $MachinePrecision] * N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{\left(u + t1\right) \cdot \left(-1 - \frac{u}{t1}\right)}
\end{array}
Initial program 71.6%
*-commutative71.6%
times-frac98.2%
neg-mul-198.2%
associate-/l*98.2%
associate-*r/98.2%
associate-/l*98.2%
associate-/l/98.2%
neg-mul-198.2%
*-lft-identity98.2%
metadata-eval98.2%
times-frac98.2%
neg-mul-198.2%
remove-double-neg98.2%
neg-mul-198.2%
sub0-neg98.2%
associate--r+98.2%
neg-sub098.2%
div-sub98.3%
distribute-frac-neg98.3%
*-inverses98.3%
metadata-eval98.3%
Simplified98.3%
expm1-log1p-u86.4%
expm1-udef51.0%
Applied egg-rr51.0%
expm1-def86.4%
expm1-log1p98.3%
associate-/l/96.8%
*-commutative96.8%
Simplified96.8%
Final simplification96.8%
(FPCore (u v t1) :precision binary64 (/ (/ v (+ u t1)) (- -1.0 (/ u t1))))
double code(double u, double v, double t1) {
return (v / (u + t1)) / (-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 / (u + t1)) / ((-1.0d0) - (u / t1))
end function
public static double code(double u, double v, double t1) {
return (v / (u + t1)) / (-1.0 - (u / t1));
}
def code(u, v, t1): return (v / (u + t1)) / (-1.0 - (u / t1))
function code(u, v, t1) return Float64(Float64(v / Float64(u + t1)) / Float64(-1.0 - Float64(u / t1))) end
function tmp = code(u, v, t1) tmp = (v / (u + t1)) / (-1.0 - (u / t1)); end
code[u_, v_, t1_] := N[(N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{u + t1}}{-1 - \frac{u}{t1}}
\end{array}
Initial program 71.6%
*-commutative71.6%
times-frac98.2%
neg-mul-198.2%
associate-/l*98.2%
associate-*r/98.2%
associate-/l*98.2%
associate-/l/98.2%
neg-mul-198.2%
*-lft-identity98.2%
metadata-eval98.2%
times-frac98.2%
neg-mul-198.2%
remove-double-neg98.2%
neg-mul-198.2%
sub0-neg98.2%
associate--r+98.2%
neg-sub098.2%
div-sub98.3%
distribute-frac-neg98.3%
*-inverses98.3%
metadata-eval98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (u v t1) :precision binary64 (if (or (<= u -6.8e+99) (not (<= u 4e+137))) (/ (- v) u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -6.8e+99) || !(u <= 4e+137)) {
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 <= (-6.8d+99)) .or. (.not. (u <= 4d+137))) 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 <= -6.8e+99) || !(u <= 4e+137)) {
tmp = -v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -6.8e+99) or not (u <= 4e+137): tmp = -v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -6.8e+99) || !(u <= 4e+137)) 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 <= -6.8e+99) || ~((u <= 4e+137))) tmp = -v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -6.8e+99], N[Not[LessEqual[u, 4e+137]], $MachinePrecision]], N[((-v) / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -6.8 \cdot 10^{+99} \lor \neg \left(u \leq 4 \cdot 10^{+137}\right):\\
\;\;\;\;\frac{-v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -6.79999999999999968e99 or 4.0000000000000001e137 < u Initial program 83.1%
*-commutative83.1%
times-frac99.4%
neg-mul-199.4%
associate-/l*99.4%
associate-*r/99.4%
associate-/l*99.4%
associate-/l/99.4%
neg-mul-199.4%
*-lft-identity99.4%
metadata-eval99.4%
times-frac99.4%
neg-mul-199.4%
remove-double-neg99.4%
neg-mul-199.4%
sub0-neg99.4%
associate--r+99.4%
neg-sub099.4%
div-sub99.4%
distribute-frac-neg99.4%
*-inverses99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in t1 around 0 91.6%
Taylor expanded in u around 0 41.8%
mul-1-neg41.8%
distribute-frac-neg41.8%
Simplified41.8%
if -6.79999999999999968e99 < u < 4.0000000000000001e137Initial program 66.2%
*-commutative66.2%
times-frac97.6%
neg-mul-197.6%
associate-/l*97.7%
associate-*r/97.7%
associate-/l*97.7%
associate-/l/97.7%
neg-mul-197.7%
*-lft-identity97.7%
metadata-eval97.7%
times-frac97.7%
neg-mul-197.7%
remove-double-neg97.7%
neg-mul-197.7%
sub0-neg97.7%
associate--r+97.7%
neg-sub097.7%
div-sub97.7%
distribute-frac-neg97.7%
*-inverses97.7%
metadata-eval97.7%
Simplified97.7%
Taylor expanded in t1 around inf 69.5%
mul-1-neg69.5%
Simplified69.5%
Final simplification60.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(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 71.6%
*-commutative71.6%
times-frac98.2%
neg-mul-198.2%
associate-/l*98.2%
associate-*r/98.2%
associate-/l*98.2%
associate-/l/98.2%
neg-mul-198.2%
*-lft-identity98.2%
metadata-eval98.2%
times-frac98.2%
neg-mul-198.2%
remove-double-neg98.2%
neg-mul-198.2%
sub0-neg98.2%
associate--r+98.2%
neg-sub098.2%
div-sub98.3%
distribute-frac-neg98.3%
*-inverses98.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in t1 around inf 53.6%
mul-1-neg53.6%
Simplified53.6%
Final simplification53.6%
(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 71.6%
Taylor expanded in t1 around inf 34.9%
unpow234.9%
Simplified34.9%
expm1-log1p-u28.7%
expm1-udef26.4%
frac-2neg26.4%
div-inv26.4%
distribute-lft-neg-out26.4%
remove-double-neg26.4%
distribute-lft-neg-in26.4%
add-sqr-sqrt14.7%
sqrt-unprod25.2%
sqr-neg25.2%
sqrt-prod10.5%
add-sqr-sqrt20.7%
pow220.7%
pow-flip20.7%
metadata-eval20.7%
Applied egg-rr20.7%
expm1-def13.1%
expm1-log1p13.3%
*-commutative13.3%
associate-*r*12.3%
*-commutative12.3%
pow-plus11.9%
metadata-eval11.9%
unpow-111.9%
*-inverses11.9%
associate-/r*12.3%
associate-*r/13.3%
times-frac11.9%
*-inverses11.9%
*-rgt-identity11.9%
Simplified11.9%
Final simplification11.9%
herbie shell --seed 2023200
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))