
(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 74.0%
times-frac99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* v (/ (- t1) (* (+ t1 u) (+ t1 u)))))
(t_2 (/ v (- (* u -2.0) t1))))
(if (<= t1 -1.35e+154)
t_2
(if (<= t1 -7.2e-166)
t_1
(if (<= t1 1.9e-165)
(/ (- t1) (* u (/ u v)))
(if (<= t1 9.8e+117) t_1 t_2))))))
double code(double u, double v, double t1) {
double t_1 = v * (-t1 / ((t1 + u) * (t1 + u)));
double t_2 = v / ((u * -2.0) - t1);
double tmp;
if (t1 <= -1.35e+154) {
tmp = t_2;
} else if (t1 <= -7.2e-166) {
tmp = t_1;
} else if (t1 <= 1.9e-165) {
tmp = -t1 / (u * (u / v));
} else if (t1 <= 9.8e+117) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = v * (-t1 / ((t1 + u) * (t1 + u)))
t_2 = v / ((u * (-2.0d0)) - t1)
if (t1 <= (-1.35d+154)) then
tmp = t_2
else if (t1 <= (-7.2d-166)) then
tmp = t_1
else if (t1 <= 1.9d-165) then
tmp = -t1 / (u * (u / v))
else if (t1 <= 9.8d+117) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = v * (-t1 / ((t1 + u) * (t1 + u)));
double t_2 = v / ((u * -2.0) - t1);
double tmp;
if (t1 <= -1.35e+154) {
tmp = t_2;
} else if (t1 <= -7.2e-166) {
tmp = t_1;
} else if (t1 <= 1.9e-165) {
tmp = -t1 / (u * (u / v));
} else if (t1 <= 9.8e+117) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(u, v, t1): t_1 = v * (-t1 / ((t1 + u) * (t1 + u))) t_2 = v / ((u * -2.0) - t1) tmp = 0 if t1 <= -1.35e+154: tmp = t_2 elif t1 <= -7.2e-166: tmp = t_1 elif t1 <= 1.9e-165: tmp = -t1 / (u * (u / v)) elif t1 <= 9.8e+117: tmp = t_1 else: tmp = t_2 return tmp
function code(u, v, t1) t_1 = Float64(v * Float64(Float64(-t1) / Float64(Float64(t1 + u) * Float64(t1 + u)))) t_2 = Float64(v / Float64(Float64(u * -2.0) - t1)) tmp = 0.0 if (t1 <= -1.35e+154) tmp = t_2; elseif (t1 <= -7.2e-166) tmp = t_1; elseif (t1 <= 1.9e-165) tmp = Float64(Float64(-t1) / Float64(u * Float64(u / v))); elseif (t1 <= 9.8e+117) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v * (-t1 / ((t1 + u) * (t1 + u))); t_2 = v / ((u * -2.0) - t1); tmp = 0.0; if (t1 <= -1.35e+154) tmp = t_2; elseif (t1 <= -7.2e-166) tmp = t_1; elseif (t1 <= 1.9e-165) tmp = -t1 / (u * (u / v)); elseif (t1 <= 9.8e+117) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v * N[((-t1) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.35e+154], t$95$2, If[LessEqual[t1, -7.2e-166], t$95$1, If[LessEqual[t1, 1.9e-165], N[((-t1) / N[(u * N[(u / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 9.8e+117], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
t_2 := \frac{v}{u \cdot -2 - t1}\\
\mathbf{if}\;t1 \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t1 \leq -7.2 \cdot 10^{-166}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t1 \leq 1.9 \cdot 10^{-165}:\\
\;\;\;\;\frac{-t1}{u \cdot \frac{u}{v}}\\
\mathbf{elif}\;t1 \leq 9.8 \cdot 10^{+117}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t1 < -1.35000000000000003e154 or 9.8000000000000002e117 < t1 Initial program 47.8%
associate-*l/50.1%
neg-mul-150.1%
associate-/l*50.1%
associate-*l/50.1%
neg-mul-150.1%
/-rgt-identity50.1%
metadata-eval50.1%
associate-/r*50.1%
times-frac98.9%
metadata-eval98.9%
/-rgt-identity98.9%
+-commutative98.9%
remove-double-neg98.9%
unsub-neg98.9%
div-sub98.9%
sub-neg98.9%
distribute-frac-neg98.9%
remove-double-neg98.9%
*-inverses98.9%
Simplified98.9%
Taylor expanded in t1 around inf 91.7%
*-commutative91.7%
Simplified91.7%
frac-2neg91.7%
remove-double-neg91.7%
div-inv91.4%
+-commutative91.4%
fma-def91.4%
Applied egg-rr91.4%
associate-*r/91.7%
*-rgt-identity91.7%
neg-sub091.7%
fma-udef91.7%
associate--r+91.7%
neg-sub091.7%
distribute-rgt-neg-in91.7%
metadata-eval91.7%
Simplified91.7%
if -1.35000000000000003e154 < t1 < -7.2000000000000002e-166 or 1.90000000000000009e-165 < t1 < 9.8000000000000002e117Initial program 90.6%
associate-*l/93.8%
*-commutative93.8%
Simplified93.8%
if -7.2000000000000002e-166 < t1 < 1.90000000000000009e-165Initial program 75.0%
times-frac96.5%
Simplified96.5%
Taylor expanded in t1 around 0 90.8%
Taylor expanded in t1 around 0 92.6%
mul-1-neg92.6%
Simplified92.6%
associate-*r/86.2%
associate-/l*93.3%
distribute-neg-frac93.3%
associate-/l/94.2%
Applied egg-rr94.2%
Final simplification93.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.5e-10) (not (<= t1 1.25e-45))) (/ v (- (* u -2.0) t1)) (* (/ (- t1) u) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.5e-10) || !(t1 <= 1.25e-45)) {
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 <= (-1.5d-10)) .or. (.not. (t1 <= 1.25d-45))) 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 <= -1.5e-10) || !(t1 <= 1.25e-45)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-t1 / u) * (v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.5e-10) or not (t1 <= 1.25e-45): tmp = v / ((u * -2.0) - t1) else: tmp = (-t1 / u) * (v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.5e-10) || !(t1 <= 1.25e-45)) 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 <= -1.5e-10) || ~((t1 <= 1.25e-45))) 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, -1.5e-10], N[Not[LessEqual[t1, 1.25e-45]], $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 -1.5 \cdot 10^{-10} \lor \neg \left(t1 \leq 1.25 \cdot 10^{-45}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u}\\
\end{array}
\end{array}
if t1 < -1.5e-10 or 1.24999999999999994e-45 < t1 Initial program 66.0%
associate-*l/68.7%
neg-mul-168.7%
associate-/l*68.7%
associate-*l/68.9%
neg-mul-168.9%
/-rgt-identity68.9%
metadata-eval68.9%
associate-/r*68.9%
times-frac97.9%
metadata-eval97.9%
/-rgt-identity97.9%
+-commutative97.9%
remove-double-neg97.9%
unsub-neg97.9%
div-sub97.9%
sub-neg97.9%
distribute-frac-neg97.9%
remove-double-neg97.9%
*-inverses97.9%
Simplified97.9%
Taylor expanded in t1 around inf 86.3%
*-commutative86.3%
Simplified86.3%
frac-2neg86.3%
remove-double-neg86.3%
div-inv86.0%
+-commutative86.0%
fma-def86.0%
Applied egg-rr86.0%
associate-*r/86.3%
*-rgt-identity86.3%
neg-sub086.3%
fma-udef86.3%
associate--r+86.3%
neg-sub086.3%
distribute-rgt-neg-in86.3%
metadata-eval86.3%
Simplified86.3%
if -1.5e-10 < t1 < 1.24999999999999994e-45Initial program 82.6%
times-frac98.2%
Simplified98.2%
Taylor expanded in t1 around 0 82.3%
Taylor expanded in t1 around 0 86.6%
mul-1-neg86.6%
Simplified86.6%
Final simplification86.4%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3e+20) (not (<= u 48000000000.0))) (/ t1 (* u (/ u v))) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3e+20) || !(u <= 48000000000.0)) {
tmp = t1 / (u * (u / v));
} 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 <= (-3d+20)) .or. (.not. (u <= 48000000000.0d0))) then
tmp = t1 / (u * (u / v))
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -3e+20) || !(u <= 48000000000.0)) {
tmp = t1 / (u * (u / v));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3e+20) or not (u <= 48000000000.0): tmp = t1 / (u * (u / v)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3e+20) || !(u <= 48000000000.0)) tmp = Float64(t1 / Float64(u * Float64(u / v))); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3e+20) || ~((u <= 48000000000.0))) tmp = t1 / (u * (u / v)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3e+20], N[Not[LessEqual[u, 48000000000.0]], $MachinePrecision]], N[(t1 / N[(u * N[(u / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3 \cdot 10^{+20} \lor \neg \left(u \leq 48000000000\right):\\
\;\;\;\;\frac{t1}{u \cdot \frac{u}{v}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -3e20 or 4.8e10 < u Initial program 85.7%
times-frac99.1%
Simplified99.1%
Taylor expanded in t1 around 0 88.9%
Taylor expanded in t1 around 0 88.4%
mul-1-neg88.4%
Simplified88.4%
associate-*r/83.8%
associate-/l*89.1%
add-sqr-sqrt53.0%
sqrt-unprod72.3%
sqr-neg72.3%
sqrt-unprod50.3%
add-sqr-sqrt69.6%
associate-/l/70.5%
Applied egg-rr70.5%
if -3e20 < u < 4.8e10Initial program 63.3%
associate-*l/72.1%
neg-mul-172.1%
associate-/l*72.1%
associate-*l/72.3%
neg-mul-172.3%
/-rgt-identity72.3%
metadata-eval72.3%
associate-/r*72.3%
times-frac99.9%
metadata-eval99.9%
/-rgt-identity99.9%
+-commutative99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
sub-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in t1 around inf 77.9%
Final simplification74.4%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.75e+21) (not (<= u 1.6e-6))) (/ t1 (* u (/ u v))) (/ v (- (* u -2.0) t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.75e+21) || !(u <= 1.6e-6)) {
tmp = t1 / (u * (u / v));
} 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) :: tmp
if ((u <= (-1.75d+21)) .or. (.not. (u <= 1.6d-6))) then
tmp = t1 / (u * (u / v))
else
tmp = v / ((u * (-2.0d0)) - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.75e+21) || !(u <= 1.6e-6)) {
tmp = t1 / (u * (u / v));
} else {
tmp = v / ((u * -2.0) - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.75e+21) or not (u <= 1.6e-6): tmp = t1 / (u * (u / v)) else: tmp = v / ((u * -2.0) - t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.75e+21) || !(u <= 1.6e-6)) tmp = Float64(t1 / Float64(u * Float64(u / v))); else tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.75e+21) || ~((u <= 1.6e-6))) tmp = t1 / (u * (u / v)); else tmp = v / ((u * -2.0) - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.75e+21], N[Not[LessEqual[u, 1.6e-6]], $MachinePrecision]], N[(t1 / N[(u * N[(u / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.75 \cdot 10^{+21} \lor \neg \left(u \leq 1.6 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{t1}{u \cdot \frac{u}{v}}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\end{array}
\end{array}
if u < -1.75e21 or 1.5999999999999999e-6 < u Initial program 85.9%
times-frac99.1%
Simplified99.1%
Taylor expanded in t1 around 0 89.1%
Taylor expanded in t1 around 0 88.5%
mul-1-neg88.5%
Simplified88.5%
associate-*r/84.1%
associate-/l*89.3%
add-sqr-sqrt53.0%
sqrt-unprod72.0%
sqr-neg72.0%
sqrt-unprod49.5%
add-sqr-sqrt68.5%
associate-/l/69.4%
Applied egg-rr69.4%
if -1.75e21 < u < 1.5999999999999999e-6Initial program 62.7%
associate-*l/71.7%
neg-mul-171.7%
associate-/l*71.7%
associate-*l/71.9%
neg-mul-171.9%
/-rgt-identity71.9%
metadata-eval71.9%
associate-/r*71.9%
times-frac99.9%
metadata-eval99.9%
/-rgt-identity99.9%
+-commutative99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
sub-neg99.9%
distribute-frac-neg99.9%
remove-double-neg99.9%
*-inverses99.9%
Simplified99.9%
Taylor expanded in t1 around inf 79.6%
*-commutative79.6%
Simplified79.6%
frac-2neg79.6%
remove-double-neg79.6%
div-inv79.3%
+-commutative79.3%
fma-def79.3%
Applied egg-rr79.3%
associate-*r/79.6%
*-rgt-identity79.6%
neg-sub079.6%
fma-udef79.6%
associate--r+79.6%
neg-sub079.6%
distribute-rgt-neg-in79.6%
metadata-eval79.6%
Simplified79.6%
Final simplification74.6%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.7e+131) (not (<= u 7.2e+193))) (/ -0.5 (/ u v)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.7e+131) || !(u <= 7.2e+193)) {
tmp = -0.5 / (u / v);
} 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.7d+131)) .or. (.not. (u <= 7.2d+193))) then
tmp = (-0.5d0) / (u / v)
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.7e+131) || !(u <= 7.2e+193)) {
tmp = -0.5 / (u / v);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.7e+131) or not (u <= 7.2e+193): tmp = -0.5 / (u / v) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.7e+131) || !(u <= 7.2e+193)) tmp = Float64(-0.5 / Float64(u / v)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.7e+131) || ~((u <= 7.2e+193))) tmp = -0.5 / (u / v); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.7e+131], N[Not[LessEqual[u, 7.2e+193]], $MachinePrecision]], N[(-0.5 / N[(u / v), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.7 \cdot 10^{+131} \lor \neg \left(u \leq 7.2 \cdot 10^{+193}\right):\\
\;\;\;\;\frac{-0.5}{\frac{u}{v}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -1.69999999999999993e131 or 7.2e193 < u Initial program 86.8%
associate-*l/87.0%
neg-mul-187.0%
associate-/l*87.0%
associate-*l/87.0%
neg-mul-187.0%
/-rgt-identity87.0%
metadata-eval87.0%
associate-/r*87.0%
times-frac91.4%
metadata-eval91.4%
/-rgt-identity91.4%
+-commutative91.4%
remove-double-neg91.4%
unsub-neg91.4%
div-sub91.4%
sub-neg91.4%
distribute-frac-neg91.4%
remove-double-neg91.4%
*-inverses91.4%
Simplified91.4%
Taylor expanded in t1 around inf 46.5%
*-commutative46.5%
Simplified46.5%
Taylor expanded in t1 around 0 45.2%
associate-*r/45.2%
associate-/l*46.2%
Simplified46.2%
if -1.69999999999999993e131 < u < 7.2e193Initial program 69.7%
associate-*l/74.1%
neg-mul-174.1%
associate-/l*73.7%
associate-*l/73.9%
neg-mul-173.9%
/-rgt-identity73.9%
metadata-eval73.9%
associate-/r*73.9%
times-frac97.7%
metadata-eval97.7%
/-rgt-identity97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
div-sub97.7%
sub-neg97.7%
distribute-frac-neg97.7%
remove-double-neg97.7%
*-inverses97.7%
Simplified97.7%
Taylor expanded in t1 around inf 64.7%
Final simplification60.0%
(FPCore (u v t1) :precision binary64 (if (<= u -2.8e+139) (/ v u) (if (<= u 5.8e+192) (/ (- v) t1) (* (/ v u) -0.5))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -2.8e+139) {
tmp = v / u;
} else if (u <= 5.8e+192) {
tmp = -v / t1;
} else {
tmp = (v / u) * -0.5;
}
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.8d+139)) then
tmp = v / u
else if (u <= 5.8d+192) then
tmp = -v / t1
else
tmp = (v / u) * (-0.5d0)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -2.8e+139) {
tmp = v / u;
} else if (u <= 5.8e+192) {
tmp = -v / t1;
} else {
tmp = (v / u) * -0.5;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -2.8e+139: tmp = v / u elif u <= 5.8e+192: tmp = -v / t1 else: tmp = (v / u) * -0.5 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -2.8e+139) tmp = Float64(v / u); elseif (u <= 5.8e+192) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(v / u) * -0.5); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -2.8e+139) tmp = v / u; elseif (u <= 5.8e+192) tmp = -v / t1; else tmp = (v / u) * -0.5; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -2.8e+139], N[(v / u), $MachinePrecision], If[LessEqual[u, 5.8e+192], N[((-v) / t1), $MachinePrecision], N[(N[(v / u), $MachinePrecision] * -0.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.8 \cdot 10^{+139}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{elif}\;u \leq 5.8 \cdot 10^{+192}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u} \cdot -0.5\\
\end{array}
\end{array}
if u < -2.7999999999999998e139Initial program 86.2%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 99.8%
expm1-log1p-u99.8%
expm1-udef86.4%
Applied egg-rr86.4%
expm1-def89.0%
expm1-log1p89.0%
associate-/r*99.7%
associate-/r/98.6%
*-commutative98.6%
Simplified98.6%
Taylor expanded in t1 around inf 41.5%
if -2.7999999999999998e139 < u < 5.8000000000000003e192Initial program 70.0%
associate-*l/74.4%
neg-mul-174.4%
associate-/l*74.0%
associate-*l/74.1%
neg-mul-174.1%
/-rgt-identity74.1%
metadata-eval74.1%
associate-/r*74.1%
times-frac97.7%
metadata-eval97.7%
/-rgt-identity97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
div-sub97.7%
sub-neg97.7%
distribute-frac-neg97.7%
remove-double-neg97.7%
*-inverses97.7%
Simplified97.7%
Taylor expanded in t1 around inf 64.6%
if 5.8000000000000003e192 < u Initial program 86.7%
associate-*l/86.8%
neg-mul-186.8%
associate-/l*86.8%
associate-*l/86.8%
neg-mul-186.8%
/-rgt-identity86.8%
metadata-eval86.8%
associate-/r*86.8%
times-frac93.6%
metadata-eval93.6%
/-rgt-identity93.6%
+-commutative93.6%
remove-double-neg93.6%
unsub-neg93.6%
div-sub93.6%
sub-neg93.6%
distribute-frac-neg93.6%
remove-double-neg93.6%
*-inverses93.6%
Simplified93.6%
Taylor expanded in t1 around inf 52.6%
*-commutative52.6%
Simplified52.6%
Taylor expanded in t1 around 0 49.4%
Final simplification59.7%
(FPCore (u v t1) :precision binary64 (if (or (<= u -5.9e+138) (not (<= u 2.1e+193))) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -5.9e+138) || !(u <= 2.1e+193)) {
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 <= (-5.9d+138)) .or. (.not. (u <= 2.1d+193))) 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 <= -5.9e+138) || !(u <= 2.1e+193)) {
tmp = v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -5.9e+138) or not (u <= 2.1e+193): tmp = v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -5.9e+138) || !(u <= 2.1e+193)) 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 <= -5.9e+138) || ~((u <= 2.1e+193))) tmp = v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -5.9e+138], N[Not[LessEqual[u, 2.1e+193]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -5.9 \cdot 10^{+138} \lor \neg \left(u \leq 2.1 \cdot 10^{+193}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -5.8999999999999999e138 or 2.1e193 < u Initial program 86.4%
times-frac100.0%
Simplified100.0%
Taylor expanded in t1 around 0 98.5%
expm1-log1p-u96.9%
expm1-udef86.5%
Applied egg-rr86.5%
expm1-def88.0%
expm1-log1p89.6%
associate-/r*98.4%
associate-/r/94.9%
*-commutative94.9%
Simplified94.9%
Taylor expanded in t1 around inf 44.8%
if -5.8999999999999999e138 < u < 2.1e193Initial program 70.0%
associate-*l/74.4%
neg-mul-174.4%
associate-/l*74.0%
associate-*l/74.1%
neg-mul-174.1%
/-rgt-identity74.1%
metadata-eval74.1%
associate-/r*74.1%
times-frac97.7%
metadata-eval97.7%
/-rgt-identity97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
div-sub97.7%
sub-neg97.7%
distribute-frac-neg97.7%
remove-double-neg97.7%
*-inverses97.7%
Simplified97.7%
Taylor expanded in t1 around inf 64.6%
Final simplification59.7%
(FPCore (u v t1) :precision binary64 (if (<= u -1.96e+139) (/ v u) (if (<= u 2.2e+193) (/ (- v) t1) (/ (- v) u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.96e+139) {
tmp = v / u;
} else if (u <= 2.2e+193) {
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 (u <= (-1.96d+139)) then
tmp = v / u
else if (u <= 2.2d+193) 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 (u <= -1.96e+139) {
tmp = v / u;
} else if (u <= 2.2e+193) {
tmp = -v / t1;
} else {
tmp = -v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.96e+139: tmp = v / u elif u <= 2.2e+193: tmp = -v / t1 else: tmp = -v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.96e+139) tmp = Float64(v / u); elseif (u <= 2.2e+193) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(-v) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -1.96e+139) tmp = v / u; elseif (u <= 2.2e+193) tmp = -v / t1; else tmp = -v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.96e+139], N[(v / u), $MachinePrecision], If[LessEqual[u, 2.2e+193], N[((-v) / t1), $MachinePrecision], N[((-v) / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.96 \cdot 10^{+139}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{elif}\;u \leq 2.2 \cdot 10^{+193}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u}\\
\end{array}
\end{array}
if u < -1.95999999999999993e139Initial program 86.2%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 99.8%
expm1-log1p-u99.8%
expm1-udef86.4%
Applied egg-rr86.4%
expm1-def89.0%
expm1-log1p89.0%
associate-/r*99.7%
associate-/r/98.6%
*-commutative98.6%
Simplified98.6%
Taylor expanded in t1 around inf 41.5%
if -1.95999999999999993e139 < u < 2.19999999999999986e193Initial program 70.0%
associate-*l/74.4%
neg-mul-174.4%
associate-/l*74.0%
associate-*l/74.1%
neg-mul-174.1%
/-rgt-identity74.1%
metadata-eval74.1%
associate-/r*74.1%
times-frac97.7%
metadata-eval97.7%
/-rgt-identity97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
div-sub97.7%
sub-neg97.7%
distribute-frac-neg97.7%
remove-double-neg97.7%
*-inverses97.7%
Simplified97.7%
Taylor expanded in t1 around inf 64.6%
if 2.19999999999999986e193 < u Initial program 86.7%
times-frac100.0%
Simplified100.0%
Taylor expanded in t1 around inf 52.5%
Taylor expanded in t1 around 0 49.3%
Final simplification59.7%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -7.8e+104) (not (<= t1 2.7e+132))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -7.8e+104) || !(t1 <= 2.7e+132)) {
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 <= (-7.8d+104)) .or. (.not. (t1 <= 2.7d+132))) 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 <= -7.8e+104) || !(t1 <= 2.7e+132)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -7.8e+104) or not (t1 <= 2.7e+132): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -7.8e+104) || !(t1 <= 2.7e+132)) 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 <= -7.8e+104) || ~((t1 <= 2.7e+132))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -7.8e+104], N[Not[LessEqual[t1, 2.7e+132]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7.8 \cdot 10^{+104} \lor \neg \left(t1 \leq 2.7 \cdot 10^{+132}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -7.80000000000000033e104 or 2.7e132 < t1 Initial program 48.1%
associate-*l/50.3%
*-commutative50.3%
Simplified50.3%
associate-*r/48.1%
*-commutative48.1%
times-frac100.0%
clear-num99.7%
frac-times66.5%
*-commutative66.5%
*-un-lft-identity66.5%
add-sqr-sqrt38.1%
sqrt-unprod7.8%
sqr-neg7.8%
sqrt-unprod22.0%
add-sqr-sqrt47.5%
frac-2neg47.5%
distribute-neg-in47.5%
add-sqr-sqrt25.5%
sqrt-unprod47.8%
sqr-neg47.8%
sqrt-unprod27.1%
add-sqr-sqrt65.3%
sub-neg65.3%
add-sqr-sqrt26.6%
sqrt-unprod51.3%
sqr-neg51.3%
sqrt-unprod31.0%
add-sqr-sqrt48.8%
Applied egg-rr48.8%
associate-/l/50.9%
associate-/r/50.9%
*-commutative50.9%
associate-/l*49.8%
associate-/r/49.8%
associate-/l/50.9%
associate-/r/49.5%
Simplified49.5%
Taylor expanded in t1 around inf 38.8%
if -7.80000000000000033e104 < t1 < 2.7e132Initial program 85.2%
times-frac98.7%
Simplified98.7%
Taylor expanded in t1 around 0 69.5%
expm1-log1p-u65.1%
expm1-udef45.4%
Applied egg-rr45.8%
expm1-def61.3%
expm1-log1p66.1%
associate-/r*69.4%
associate-/r/67.7%
*-commutative67.7%
Simplified67.7%
Taylor expanded in t1 around inf 21.9%
Final simplification27.0%
(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 74.0%
times-frac99.1%
Simplified99.1%
Taylor expanded in t1 around inf 62.0%
Final simplification62.0%
(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 74.0%
associate-*l/77.4%
*-commutative77.4%
Simplified77.4%
associate-*r/74.0%
*-commutative74.0%
times-frac99.1%
clear-num98.8%
frac-times83.3%
*-commutative83.3%
*-un-lft-identity83.3%
add-sqr-sqrt40.5%
sqrt-unprod42.3%
sqr-neg42.3%
sqrt-unprod24.0%
add-sqr-sqrt43.1%
frac-2neg43.1%
distribute-neg-in43.1%
add-sqr-sqrt19.1%
sqrt-unprod53.5%
sqr-neg53.5%
sqrt-unprod36.4%
add-sqr-sqrt65.8%
sub-neg65.8%
add-sqr-sqrt31.6%
sqrt-unprod53.1%
sqr-neg53.1%
sqrt-unprod33.8%
add-sqr-sqrt60.1%
Applied egg-rr60.1%
associate-/l/61.0%
associate-/r/60.8%
*-commutative60.8%
associate-/l*59.2%
associate-/r/59.1%
associate-/l/61.8%
associate-/r/60.2%
Simplified60.2%
Taylor expanded in t1 around inf 15.0%
Final simplification15.0%
herbie shell --seed 2023326
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))