
(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 (* (/ (- v) (+ t1 u)) (/ t1 (+ t1 u))))
double code(double u, double v, double t1) {
return (-v / (t1 + u)) * (t1 / (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)) * (t1 / (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-v / (t1 + u)) * (t1 / (t1 + u));
}
def code(u, v, t1): return (-v / (t1 + u)) * (t1 / (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-v) / Float64(t1 + u)) * Float64(t1 / Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-v / (t1 + u)) * (t1 / (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{t1 + u} \cdot \frac{t1}{t1 + u}
\end{array}
Initial program 72.5%
times-frac98.9%
distribute-frac-neg98.9%
distribute-neg-frac298.9%
+-commutative98.9%
distribute-neg-in98.9%
unsub-neg98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3e-44) (not (<= u 1.1e-33))) (* (/ v (+ t1 u)) (/ t1 (- u))) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3e-44) || !(u <= 1.1e-33)) {
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 <= (-3d-44)) .or. (.not. (u <= 1.1d-33))) 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 <= -3e-44) || !(u <= 1.1e-33)) {
tmp = (v / (t1 + u)) * (t1 / -u);
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3e-44) or not (u <= 1.1e-33): tmp = (v / (t1 + u)) * (t1 / -u) else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3e-44) || !(u <= 1.1e-33)) tmp = Float64(Float64(v / Float64(t1 + u)) * Float64(t1 / Float64(-u))); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3e-44) || ~((u <= 1.1e-33))) tmp = (v / (t1 + u)) * (t1 / -u); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3e-44], N[Not[LessEqual[u, 1.1e-33]], $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 -3 \cdot 10^{-44} \lor \neg \left(u \leq 1.1 \cdot 10^{-33}\right):\\
\;\;\;\;\frac{v}{t1 + u} \cdot \frac{t1}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -3.0000000000000002e-44 or 1.10000000000000003e-33 < u Initial program 81.6%
times-frac99.4%
distribute-frac-neg99.4%
distribute-neg-frac299.4%
+-commutative99.4%
distribute-neg-in99.4%
unsub-neg99.4%
Simplified99.4%
Taylor expanded in t1 around 0 81.9%
associate-*r/81.9%
mul-1-neg81.9%
Simplified81.9%
if -3.0000000000000002e-44 < u < 1.10000000000000003e-33Initial program 63.0%
times-frac98.5%
distribute-frac-neg98.5%
distribute-neg-frac298.5%
+-commutative98.5%
distribute-neg-in98.5%
unsub-neg98.5%
Simplified98.5%
Taylor expanded in t1 around inf 80.7%
associate-*r/80.7%
neg-mul-180.7%
Simplified80.7%
Final simplification81.3%
(FPCore (u v t1) :precision binary64 (if (or (<= u -4.3e-50) (not (<= u 4e-34))) (* t1 (/ (/ v (+ t1 u)) (- u))) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -4.3e-50) || !(u <= 4e-34)) {
tmp = t1 * ((v / (t1 + 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.3d-50)) .or. (.not. (u <= 4d-34))) then
tmp = t1 * ((v / (t1 + 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.3e-50) || !(u <= 4e-34)) {
tmp = t1 * ((v / (t1 + u)) / -u);
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -4.3e-50) or not (u <= 4e-34): tmp = t1 * ((v / (t1 + u)) / -u) else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -4.3e-50) || !(u <= 4e-34)) tmp = Float64(t1 * Float64(Float64(v / Float64(t1 + u)) / Float64(-u))); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -4.3e-50) || ~((u <= 4e-34))) tmp = t1 * ((v / (t1 + u)) / -u); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -4.3e-50], N[Not[LessEqual[u, 4e-34]], $MachinePrecision]], N[(t1 * N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision]), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -4.3 \cdot 10^{-50} \lor \neg \left(u \leq 4 \cdot 10^{-34}\right):\\
\;\;\;\;t1 \cdot \frac{\frac{v}{t1 + u}}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -4.29999999999999997e-50 or 3.99999999999999971e-34 < u Initial program 81.6%
associate-/l*83.4%
distribute-lft-neg-out83.4%
distribute-rgt-neg-in83.4%
associate-/r*92.5%
distribute-neg-frac292.5%
Simplified92.5%
Taylor expanded in t1 around 0 79.8%
if -4.29999999999999997e-50 < u < 3.99999999999999971e-34Initial program 63.0%
times-frac98.5%
distribute-frac-neg98.5%
distribute-neg-frac298.5%
+-commutative98.5%
distribute-neg-in98.5%
unsub-neg98.5%
Simplified98.5%
Taylor expanded in t1 around inf 80.7%
associate-*r/80.7%
neg-mul-180.7%
Simplified80.7%
Final simplification80.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.6e+18) (not (<= t1 1.95e-119))) (/ v (- u t1)) (* t1 (/ (/ v u) (- u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.6e+18) || !(t1 <= 1.95e-119)) {
tmp = v / (u - t1);
} else {
tmp = t1 * ((v / u) / -u);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-2.6d+18)) .or. (.not. (t1 <= 1.95d-119))) then
tmp = v / (u - t1)
else
tmp = t1 * ((v / u) / -u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.6e+18) || !(t1 <= 1.95e-119)) {
tmp = v / (u - t1);
} else {
tmp = t1 * ((v / u) / -u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.6e+18) or not (t1 <= 1.95e-119): tmp = v / (u - t1) else: tmp = t1 * ((v / u) / -u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.6e+18) || !(t1 <= 1.95e-119)) tmp = Float64(v / Float64(u - t1)); else tmp = Float64(t1 * Float64(Float64(v / u) / Float64(-u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.6e+18) || ~((t1 <= 1.95e-119))) tmp = v / (u - t1); else tmp = t1 * ((v / u) / -u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.6e+18], N[Not[LessEqual[t1, 1.95e-119]], $MachinePrecision]], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[(t1 * N[(N[(v / u), $MachinePrecision] / (-u)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.6 \cdot 10^{+18} \lor \neg \left(t1 \leq 1.95 \cdot 10^{-119}\right):\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;t1 \cdot \frac{\frac{v}{u}}{-u}\\
\end{array}
\end{array}
if t1 < -2.6e18 or 1.94999999999999995e-119 < t1 Initial program 68.4%
times-frac100.0%
distribute-frac-neg100.0%
distribute-neg-frac2100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in t1 around inf 83.3%
add-sqr-sqrt39.4%
add-sqr-sqrt22.8%
difference-of-squares22.8%
add-sqr-sqrt22.8%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod22.2%
sqr-neg22.2%
sqrt-unprod22.1%
add-sqr-sqrt22.1%
Applied egg-rr22.1%
difference-of-squares22.1%
rem-square-sqrt45.2%
rem-square-sqrt83.5%
Simplified83.5%
Taylor expanded in v around 0 83.5%
if -2.6e18 < t1 < 1.94999999999999995e-119Initial program 77.7%
associate-/l*83.0%
distribute-lft-neg-out83.0%
distribute-rgt-neg-in83.0%
associate-/r*89.9%
distribute-neg-frac289.9%
Simplified89.9%
Taylor expanded in t1 around 0 72.8%
Taylor expanded in t1 around 0 74.0%
Final simplification79.2%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.35e+181) (not (<= u 6.8e+202))) (* t1 (/ (/ v u) u)) (/ v (- u t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.35e+181) || !(u <= 6.8e+202)) {
tmp = t1 * ((v / u) / u);
} else {
tmp = v / (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 <= (-1.35d+181)) .or. (.not. (u <= 6.8d+202))) then
tmp = t1 * ((v / u) / u)
else
tmp = v / (u - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.35e+181) || !(u <= 6.8e+202)) {
tmp = t1 * ((v / u) / u);
} else {
tmp = v / (u - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.35e+181) or not (u <= 6.8e+202): tmp = t1 * ((v / u) / u) else: tmp = v / (u - t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.35e+181) || !(u <= 6.8e+202)) tmp = Float64(t1 * Float64(Float64(v / u) / u)); else tmp = Float64(v / Float64(u - t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.35e+181) || ~((u <= 6.8e+202))) tmp = t1 * ((v / u) / u); else tmp = v / (u - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.35e+181], N[Not[LessEqual[u, 6.8e+202]], $MachinePrecision]], N[(t1 * N[(N[(v / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.35 \cdot 10^{+181} \lor \neg \left(u \leq 6.8 \cdot 10^{+202}\right):\\
\;\;\;\;t1 \cdot \frac{\frac{v}{u}}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u - t1}\\
\end{array}
\end{array}
if u < -1.35000000000000004e181 or 6.8e202 < u Initial program 84.2%
associate-*l/84.5%
*-commutative84.5%
Simplified84.5%
Taylor expanded in t1 around 0 84.5%
Taylor expanded in t1 around 0 84.5%
associate-*r/84.2%
associate-/r*94.2%
*-commutative94.2%
add-sqr-sqrt44.2%
sqrt-unprod76.9%
sqr-neg76.9%
sqrt-unprod49.3%
add-sqr-sqrt84.1%
Applied egg-rr84.1%
associate-/l*84.2%
associate-/l*84.4%
Applied egg-rr84.4%
if -1.35000000000000004e181 < u < 6.8e202Initial program 70.1%
times-frac98.9%
distribute-frac-neg98.9%
distribute-neg-frac298.9%
+-commutative98.9%
distribute-neg-in98.9%
unsub-neg98.9%
Simplified98.9%
Taylor expanded in t1 around inf 63.6%
add-sqr-sqrt29.3%
add-sqr-sqrt15.2%
difference-of-squares15.2%
add-sqr-sqrt15.2%
sqrt-unprod15.2%
sqr-neg15.2%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod14.1%
sqr-neg14.1%
sqrt-unprod13.7%
add-sqr-sqrt13.7%
Applied egg-rr13.7%
difference-of-squares13.7%
rem-square-sqrt29.3%
rem-square-sqrt64.8%
Simplified64.8%
Taylor expanded in v around 0 64.4%
Final simplification67.9%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.2e+198) (/ v (- u t1)) (* t1 (/ (/ v (+ t1 u)) (- (- u) t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.2e+198) {
tmp = v / (u - t1);
} else {
tmp = t1 * ((v / (t1 + u)) / (-u - t1));
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (t1 <= (-1.2d+198)) then
tmp = v / (u - t1)
else
tmp = t1 * ((v / (t1 + u)) / (-u - t1))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.2e+198) {
tmp = v / (u - t1);
} else {
tmp = t1 * ((v / (t1 + u)) / (-u - t1));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.2e+198: tmp = v / (u - t1) else: tmp = t1 * ((v / (t1 + u)) / (-u - t1)) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.2e+198) tmp = Float64(v / Float64(u - t1)); else tmp = Float64(t1 * Float64(Float64(v / Float64(t1 + u)) / Float64(Float64(-u) - t1))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.2e+198) tmp = v / (u - t1); else tmp = t1 * ((v / (t1 + u)) / (-u - t1)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.2e+198], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], N[(t1 * N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.2 \cdot 10^{+198}:\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{else}:\\
\;\;\;\;t1 \cdot \frac{\frac{v}{t1 + u}}{\left(-u\right) - t1}\\
\end{array}
\end{array}
if t1 < -1.2000000000000001e198Initial program 34.2%
times-frac100.0%
distribute-frac-neg100.0%
distribute-neg-frac2100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in t1 around inf 96.4%
add-sqr-sqrt30.8%
add-sqr-sqrt0.0%
difference-of-squares0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
Applied egg-rr0.0%
difference-of-squares0.0%
rem-square-sqrt0.0%
rem-square-sqrt96.6%
Simplified96.6%
Taylor expanded in v around 0 96.6%
if -1.2000000000000001e198 < t1 Initial program 76.9%
associate-/l*81.9%
distribute-lft-neg-out81.9%
distribute-rgt-neg-in81.9%
associate-/r*92.6%
distribute-neg-frac292.6%
Simplified92.6%
Final simplification93.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -4e+181) (not (<= u 4.8e+199))) (/ v u) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -4e+181) || !(u <= 4.8e+199)) {
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 <= (-4d+181)) .or. (.not. (u <= 4.8d+199))) 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 <= -4e+181) || !(u <= 4.8e+199)) {
tmp = v / u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -4e+181) or not (u <= 4.8e+199): tmp = v / u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -4e+181) || !(u <= 4.8e+199)) tmp = Float64(v / u); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -4e+181) || ~((u <= 4.8e+199))) tmp = v / u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -4e+181], N[Not[LessEqual[u, 4.8e+199]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -4 \cdot 10^{+181} \lor \neg \left(u \leq 4.8 \cdot 10^{+199}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -3.9999999999999997e181 or 4.8000000000000003e199 < u Initial program 84.6%
times-frac99.3%
distribute-frac-neg99.3%
distribute-neg-frac299.3%
+-commutative99.3%
distribute-neg-in99.3%
unsub-neg99.3%
Simplified99.3%
Taylor expanded in t1 around inf 55.2%
add-sqr-sqrt36.8%
add-sqr-sqrt20.4%
difference-of-squares20.4%
add-sqr-sqrt20.4%
sqrt-unprod28.9%
sqr-neg28.9%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod11.3%
sqr-neg11.3%
sqrt-unprod11.2%
add-sqr-sqrt11.2%
Applied egg-rr11.2%
difference-of-squares11.2%
rem-square-sqrt31.6%
rem-square-sqrt55.3%
Simplified55.3%
Taylor expanded in t1 around 0 43.2%
if -3.9999999999999997e181 < u < 4.8000000000000003e199Initial program 70.0%
times-frac98.9%
distribute-frac-neg98.9%
distribute-neg-frac298.9%
+-commutative98.9%
distribute-neg-in98.9%
unsub-neg98.9%
Simplified98.9%
Taylor expanded in t1 around inf 62.6%
associate-*r/62.6%
neg-mul-162.6%
Simplified62.6%
Final simplification59.2%
(FPCore (u v t1) :precision binary64 (if (<= u -1.45e+181) (/ v (- u)) (if (<= u 9.2e+198) (/ v (- t1)) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.45e+181) {
tmp = v / -u;
} else if (u <= 9.2e+198) {
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.45d+181)) then
tmp = v / -u
else if (u <= 9.2d+198) 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.45e+181) {
tmp = v / -u;
} else if (u <= 9.2e+198) {
tmp = v / -t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.45e+181: tmp = v / -u elif u <= 9.2e+198: tmp = v / -t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.45e+181) tmp = Float64(v / Float64(-u)); elseif (u <= 9.2e+198) tmp = Float64(v / Float64(-t1)); else tmp = Float64(v / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -1.45e+181) tmp = v / -u; elseif (u <= 9.2e+198) tmp = v / -t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.45e+181], N[(v / (-u)), $MachinePrecision], If[LessEqual[u, 9.2e+198], N[(v / (-t1)), $MachinePrecision], N[(v / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.45 \cdot 10^{+181}:\\
\;\;\;\;\frac{v}{-u}\\
\mathbf{elif}\;u \leq 9.2 \cdot 10^{+198}:\\
\;\;\;\;\frac{v}{-t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if u < -1.45e181Initial program 86.9%
times-frac100.0%
distribute-frac-neg100.0%
distribute-neg-frac2100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in t1 around inf 41.3%
Taylor expanded in t1 around 0 38.2%
associate-*r/38.2%
mul-1-neg38.2%
Simplified38.2%
if -1.45e181 < u < 9.2000000000000002e198Initial program 70.3%
times-frac98.9%
distribute-frac-neg98.9%
distribute-neg-frac298.9%
+-commutative98.9%
distribute-neg-in98.9%
unsub-neg98.9%
Simplified98.9%
Taylor expanded in t1 around inf 62.9%
associate-*r/62.9%
neg-mul-162.9%
Simplified62.9%
if 9.2000000000000002e198 < u Initial program 75.9%
times-frac98.1%
distribute-frac-neg98.1%
distribute-neg-frac298.1%
+-commutative98.1%
distribute-neg-in98.1%
unsub-neg98.1%
Simplified98.1%
Taylor expanded in t1 around inf 48.6%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
difference-of-squares0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod29.8%
sqr-neg29.8%
sqrt-unprod29.6%
add-sqr-sqrt29.6%
Applied egg-rr29.6%
difference-of-squares29.6%
rem-square-sqrt29.6%
rem-square-sqrt49.3%
Simplified49.3%
Taylor expanded in t1 around 0 50.0%
Final simplification59.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -7.4e+205) (not (<= t1 7.5e+76))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -7.4e+205) || !(t1 <= 7.5e+76)) {
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.4d+205)) .or. (.not. (t1 <= 7.5d+76))) 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.4e+205) || !(t1 <= 7.5e+76)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -7.4e+205) or not (t1 <= 7.5e+76): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -7.4e+205) || !(t1 <= 7.5e+76)) 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.4e+205) || ~((t1 <= 7.5e+76))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -7.4e+205], N[Not[LessEqual[t1, 7.5e+76]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7.4 \cdot 10^{+205} \lor \neg \left(t1 \leq 7.5 \cdot 10^{+76}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -7.39999999999999961e205 or 7.4999999999999995e76 < t1 Initial program 54.9%
times-frac100.0%
distribute-frac-neg100.0%
distribute-neg-frac2100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
Simplified100.0%
Taylor expanded in t1 around inf 97.1%
associate-*r/97.1%
neg-mul-197.1%
Simplified97.1%
distribute-frac-neg97.1%
div-inv96.8%
distribute-rgt-neg-in96.8%
frac-2neg96.8%
metadata-eval96.8%
add-sqr-sqrt37.0%
sqrt-unprod40.5%
sqr-neg40.5%
sqrt-unprod25.0%
add-sqr-sqrt39.7%
Applied egg-rr39.7%
distribute-rgt-neg-out39.7%
*-commutative39.7%
associate-*l/39.7%
mul-1-neg39.7%
distribute-neg-frac39.7%
remove-double-neg39.7%
Simplified39.7%
if -7.39999999999999961e205 < t1 < 7.4999999999999995e76Initial program 78.2%
times-frac98.6%
distribute-frac-neg98.6%
distribute-neg-frac298.6%
+-commutative98.6%
distribute-neg-in98.6%
unsub-neg98.6%
Simplified98.6%
Taylor expanded in t1 around inf 50.7%
add-sqr-sqrt26.6%
add-sqr-sqrt11.1%
difference-of-squares11.1%
add-sqr-sqrt11.1%
sqrt-unprod13.0%
sqr-neg13.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod9.2%
sqr-neg9.2%
sqrt-unprod8.8%
add-sqr-sqrt8.8%
Applied egg-rr8.8%
difference-of-squares8.8%
rem-square-sqrt20.3%
rem-square-sqrt52.1%
Simplified52.1%
Taylor expanded in t1 around 0 15.4%
Final simplification21.3%
(FPCore (u v t1) :precision binary64 (/ v (- u t1)))
double code(double u, double v, double t1) {
return v / (u - t1);
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = v / (u - t1)
end function
public static double code(double u, double v, double t1) {
return v / (u - t1);
}
def code(u, v, t1): return v / (u - t1)
function code(u, v, t1) return Float64(v / Float64(u - t1)) end
function tmp = code(u, v, t1) tmp = v / (u - t1); end
code[u_, v_, t1_] := N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u - t1}
\end{array}
Initial program 72.5%
times-frac98.9%
distribute-frac-neg98.9%
distribute-neg-frac298.9%
+-commutative98.9%
distribute-neg-in98.9%
unsub-neg98.9%
Simplified98.9%
Taylor expanded in t1 around inf 61.9%
add-sqr-sqrt30.7%
add-sqr-sqrt16.2%
difference-of-squares16.2%
add-sqr-sqrt16.2%
sqrt-unprod17.7%
sqr-neg17.7%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod13.6%
sqr-neg13.6%
sqrt-unprod13.3%
add-sqr-sqrt13.3%
Applied egg-rr13.3%
difference-of-squares13.3%
rem-square-sqrt29.8%
rem-square-sqrt63.0%
Simplified63.0%
Taylor expanded in v around 0 60.9%
(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 72.5%
times-frac98.9%
distribute-frac-neg98.9%
distribute-neg-frac298.9%
+-commutative98.9%
distribute-neg-in98.9%
unsub-neg98.9%
Simplified98.9%
Taylor expanded in t1 around inf 54.2%
associate-*r/54.2%
neg-mul-154.2%
Simplified54.2%
distribute-frac-neg54.2%
div-inv54.0%
distribute-rgt-neg-in54.0%
frac-2neg54.0%
metadata-eval54.0%
add-sqr-sqrt28.7%
sqrt-unprod27.6%
sqr-neg27.6%
sqrt-unprod7.5%
add-sqr-sqrt12.6%
Applied egg-rr12.6%
distribute-rgt-neg-out12.6%
*-commutative12.6%
associate-*l/12.6%
mul-1-neg12.6%
distribute-neg-frac12.6%
remove-double-neg12.6%
Simplified12.6%
herbie shell --seed 2024139
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))