
(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 72.4%
times-frac98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (u v t1)
:precision binary64
(if (or (<= t1 -4.8e+24)
(and (not (<= t1 -2.5e-19))
(or (<= t1 -2.5e-45) (not (<= t1 6.2e-73)))))
(/ (- v) (+ t1 u))
(* (/ (- t1) u) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4.8e+24) || (!(t1 <= -2.5e-19) && ((t1 <= -2.5e-45) || !(t1 <= 6.2e-73)))) {
tmp = -v / (t1 + u);
} 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 <= (-4.8d+24)) .or. (.not. (t1 <= (-2.5d-19))) .and. (t1 <= (-2.5d-45)) .or. (.not. (t1 <= 6.2d-73))) then
tmp = -v / (t1 + u)
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 <= -4.8e+24) || (!(t1 <= -2.5e-19) && ((t1 <= -2.5e-45) || !(t1 <= 6.2e-73)))) {
tmp = -v / (t1 + u);
} else {
tmp = (-t1 / u) * (v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -4.8e+24) or (not (t1 <= -2.5e-19) and ((t1 <= -2.5e-45) or not (t1 <= 6.2e-73))): tmp = -v / (t1 + u) else: tmp = (-t1 / u) * (v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -4.8e+24) || (!(t1 <= -2.5e-19) && ((t1 <= -2.5e-45) || !(t1 <= 6.2e-73)))) tmp = Float64(Float64(-v) / Float64(t1 + u)); 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 <= -4.8e+24) || (~((t1 <= -2.5e-19)) && ((t1 <= -2.5e-45) || ~((t1 <= 6.2e-73))))) tmp = -v / (t1 + u); else tmp = (-t1 / u) * (v / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -4.8e+24], And[N[Not[LessEqual[t1, -2.5e-19]], $MachinePrecision], Or[LessEqual[t1, -2.5e-45], N[Not[LessEqual[t1, 6.2e-73]], $MachinePrecision]]]], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) / u), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4.8 \cdot 10^{+24} \lor \neg \left(t1 \leq -2.5 \cdot 10^{-19}\right) \land \left(t1 \leq -2.5 \cdot 10^{-45} \lor \neg \left(t1 \leq 6.2 \cdot 10^{-73}\right)\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u}\\
\end{array}
\end{array}
if t1 < -4.8000000000000001e24 or -2.5000000000000002e-19 < t1 < -2.49999999999999988e-45 or 6.19999999999999938e-73 < t1 Initial program 67.2%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around inf 83.7%
if -4.8000000000000001e24 < t1 < -2.5000000000000002e-19 or -2.49999999999999988e-45 < t1 < 6.19999999999999938e-73Initial program 78.9%
times-frac95.6%
Simplified95.6%
Taylor expanded in t1 around 0 78.2%
associate-*r/78.2%
neg-mul-178.2%
Simplified78.2%
Taylor expanded in t1 around 0 82.0%
Final simplification82.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))) (t_2 (* (/ (- t1) u) (/ v u))))
(if (<= t1 -4.3e+27)
t_1
(if (<= t1 -3.6e-19)
t_2
(if (<= t1 -8.8e-45)
t_1
(if (<= t1 3.65e-72) t_2 (/ -1.0 (/ (+ t1 u) v))))))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double t_2 = (-t1 / u) * (v / u);
double tmp;
if (t1 <= -4.3e+27) {
tmp = t_1;
} else if (t1 <= -3.6e-19) {
tmp = t_2;
} else if (t1 <= -8.8e-45) {
tmp = t_1;
} else if (t1 <= 3.65e-72) {
tmp = t_2;
} else {
tmp = -1.0 / ((t1 + u) / v);
}
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 + u)
t_2 = (-t1 / u) * (v / u)
if (t1 <= (-4.3d+27)) then
tmp = t_1
else if (t1 <= (-3.6d-19)) then
tmp = t_2
else if (t1 <= (-8.8d-45)) then
tmp = t_1
else if (t1 <= 3.65d-72) then
tmp = t_2
else
tmp = (-1.0d0) / ((t1 + u) / v)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double t_2 = (-t1 / u) * (v / u);
double tmp;
if (t1 <= -4.3e+27) {
tmp = t_1;
} else if (t1 <= -3.6e-19) {
tmp = t_2;
} else if (t1 <= -8.8e-45) {
tmp = t_1;
} else if (t1 <= 3.65e-72) {
tmp = t_2;
} else {
tmp = -1.0 / ((t1 + u) / v);
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) t_2 = (-t1 / u) * (v / u) tmp = 0 if t1 <= -4.3e+27: tmp = t_1 elif t1 <= -3.6e-19: tmp = t_2 elif t1 <= -8.8e-45: tmp = t_1 elif t1 <= 3.65e-72: tmp = t_2 else: tmp = -1.0 / ((t1 + u) / v) return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) t_2 = Float64(Float64(Float64(-t1) / u) * Float64(v / u)) tmp = 0.0 if (t1 <= -4.3e+27) tmp = t_1; elseif (t1 <= -3.6e-19) tmp = t_2; elseif (t1 <= -8.8e-45) tmp = t_1; elseif (t1 <= 3.65e-72) tmp = t_2; else tmp = Float64(-1.0 / Float64(Float64(t1 + u) / v)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (t1 + u); t_2 = (-t1 / u) * (v / u); tmp = 0.0; if (t1 <= -4.3e+27) tmp = t_1; elseif (t1 <= -3.6e-19) tmp = t_2; elseif (t1 <= -8.8e-45) tmp = t_1; elseif (t1 <= 3.65e-72) tmp = t_2; else tmp = -1.0 / ((t1 + u) / v); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-t1) / u), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -4.3e+27], t$95$1, If[LessEqual[t1, -3.6e-19], t$95$2, If[LessEqual[t1, -8.8e-45], t$95$1, If[LessEqual[t1, 3.65e-72], t$95$2, N[(-1.0 / N[(N[(t1 + u), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
t_2 := \frac{-t1}{u} \cdot \frac{v}{u}\\
\mathbf{if}\;t1 \leq -4.3 \cdot 10^{+27}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq -3.6 \cdot 10^{-19}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t1 \leq -8.8 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 3.65 \cdot 10^{-72}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{t1 + u}{v}}\\
\end{array}
\end{array}
if t1 < -4.30000000000000008e27 or -3.6000000000000001e-19 < t1 < -8.79999999999999974e-45Initial program 59.7%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around inf 86.7%
if -4.30000000000000008e27 < t1 < -3.6000000000000001e-19 or -8.79999999999999974e-45 < t1 < 3.65000000000000001e-72Initial program 78.9%
times-frac95.6%
Simplified95.6%
Taylor expanded in t1 around 0 78.2%
associate-*r/78.2%
neg-mul-178.2%
Simplified78.2%
Taylor expanded in t1 around 0 82.0%
if 3.65000000000000001e-72 < t1 Initial program 74.8%
times-frac99.9%
Simplified99.9%
clear-num99.1%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in t1 around inf 80.5%
associate-/r/80.9%
Applied egg-rr80.9%
Final simplification83.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))))
(if (<= t1 -1.3e+25)
t_1
(if (<= t1 -3.9e-20)
(/ (/ (* t1 v) u) (- t1 u))
(if (<= t1 -8e-45)
t_1
(if (<= t1 6.2e-73)
(* (/ (- t1) u) (/ v u))
(/ -1.0 (/ (+ t1 u) v))))))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.3e+25) {
tmp = t_1;
} else if (t1 <= -3.9e-20) {
tmp = ((t1 * v) / u) / (t1 - u);
} else if (t1 <= -8e-45) {
tmp = t_1;
} else if (t1 <= 6.2e-73) {
tmp = (-t1 / u) * (v / u);
} else {
tmp = -1.0 / ((t1 + u) / v);
}
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)
if (t1 <= (-1.3d+25)) then
tmp = t_1
else if (t1 <= (-3.9d-20)) then
tmp = ((t1 * v) / u) / (t1 - u)
else if (t1 <= (-8d-45)) then
tmp = t_1
else if (t1 <= 6.2d-73) then
tmp = (-t1 / u) * (v / u)
else
tmp = (-1.0d0) / ((t1 + u) / v)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.3e+25) {
tmp = t_1;
} else if (t1 <= -3.9e-20) {
tmp = ((t1 * v) / u) / (t1 - u);
} else if (t1 <= -8e-45) {
tmp = t_1;
} else if (t1 <= 6.2e-73) {
tmp = (-t1 / u) * (v / u);
} else {
tmp = -1.0 / ((t1 + u) / v);
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -1.3e+25: tmp = t_1 elif t1 <= -3.9e-20: tmp = ((t1 * v) / u) / (t1 - u) elif t1 <= -8e-45: tmp = t_1 elif t1 <= 6.2e-73: tmp = (-t1 / u) * (v / u) else: tmp = -1.0 / ((t1 + u) / v) return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -1.3e+25) tmp = t_1; elseif (t1 <= -3.9e-20) tmp = Float64(Float64(Float64(t1 * v) / u) / Float64(t1 - u)); elseif (t1 <= -8e-45) tmp = t_1; elseif (t1 <= 6.2e-73) tmp = Float64(Float64(Float64(-t1) / u) * Float64(v / u)); else tmp = Float64(-1.0 / Float64(Float64(t1 + u) / v)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (t1 + u); tmp = 0.0; if (t1 <= -1.3e+25) tmp = t_1; elseif (t1 <= -3.9e-20) tmp = ((t1 * v) / u) / (t1 - u); elseif (t1 <= -8e-45) tmp = t_1; elseif (t1 <= 6.2e-73) tmp = (-t1 / u) * (v / u); else tmp = -1.0 / ((t1 + u) / v); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.3e+25], t$95$1, If[LessEqual[t1, -3.9e-20], N[(N[(N[(t1 * v), $MachinePrecision] / u), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -8e-45], t$95$1, If[LessEqual[t1, 6.2e-73], N[(N[((-t1) / u), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(N[(t1 + u), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq -3.9 \cdot 10^{-20}:\\
\;\;\;\;\frac{\frac{t1 \cdot v}{u}}{t1 - u}\\
\mathbf{elif}\;t1 \leq -8 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 6.2 \cdot 10^{-73}:\\
\;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{t1 + u}{v}}\\
\end{array}
\end{array}
if t1 < -1.2999999999999999e25 or -3.90000000000000007e-20 < t1 < -7.99999999999999987e-45Initial program 59.7%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around inf 86.7%
if -1.2999999999999999e25 < t1 < -3.90000000000000007e-20Initial program 58.4%
associate-/l*58.4%
Simplified58.4%
associate-*r/58.4%
frac-times99.8%
frac-2neg99.8%
remove-double-neg99.8%
associate-*l/99.7%
distribute-neg-in99.7%
add-sqr-sqrt99.5%
sqrt-unprod99.7%
sqr-neg99.7%
sqrt-unprod0.0%
add-sqr-sqrt88.8%
sub-neg88.8%
Applied egg-rr88.8%
Taylor expanded in t1 around 0 89.1%
if -7.99999999999999987e-45 < t1 < 6.19999999999999938e-73Initial program 80.6%
times-frac95.3%
Simplified95.3%
Taylor expanded in t1 around 0 77.3%
associate-*r/77.3%
neg-mul-177.3%
Simplified77.3%
Taylor expanded in t1 around 0 81.4%
if 6.19999999999999938e-73 < t1 Initial program 74.8%
times-frac99.9%
Simplified99.9%
clear-num99.1%
associate-/r/99.7%
Applied egg-rr99.7%
Taylor expanded in t1 around inf 80.5%
associate-/r/80.9%
Applied egg-rr80.9%
Final simplification83.0%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -3.6e+98)
(/ (- v) (+ t1 u))
(if (<= t1 6.2e+73)
(* t1 (/ (- v) (* (+ t1 u) (+ t1 u))))
(/ -1.0 (/ (+ t1 u) v)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -3.6e+98) {
tmp = -v / (t1 + u);
} else if (t1 <= 6.2e+73) {
tmp = t1 * (-v / ((t1 + u) * (t1 + u)));
} else {
tmp = -1.0 / ((t1 + u) / v);
}
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 <= (-3.6d+98)) then
tmp = -v / (t1 + u)
else if (t1 <= 6.2d+73) then
tmp = t1 * (-v / ((t1 + u) * (t1 + u)))
else
tmp = (-1.0d0) / ((t1 + u) / v)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -3.6e+98) {
tmp = -v / (t1 + u);
} else if (t1 <= 6.2e+73) {
tmp = t1 * (-v / ((t1 + u) * (t1 + u)));
} else {
tmp = -1.0 / ((t1 + u) / v);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -3.6e+98: tmp = -v / (t1 + u) elif t1 <= 6.2e+73: tmp = t1 * (-v / ((t1 + u) * (t1 + u))) else: tmp = -1.0 / ((t1 + u) / v) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -3.6e+98) tmp = Float64(Float64(-v) / Float64(t1 + u)); elseif (t1 <= 6.2e+73) tmp = Float64(t1 * Float64(Float64(-v) / Float64(Float64(t1 + u) * Float64(t1 + u)))); else tmp = Float64(-1.0 / Float64(Float64(t1 + u) / v)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -3.6e+98) tmp = -v / (t1 + u); elseif (t1 <= 6.2e+73) tmp = t1 * (-v / ((t1 + u) * (t1 + u))); else tmp = -1.0 / ((t1 + u) / v); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -3.6e+98], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 6.2e+73], N[(t1 * N[((-v) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-1.0 / N[(N[(t1 + u), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -3.6 \cdot 10^{+98}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{elif}\;t1 \leq 6.2 \cdot 10^{+73}:\\
\;\;\;\;t1 \cdot \frac{-v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-1}{\frac{t1 + u}{v}}\\
\end{array}
\end{array}
if t1 < -3.59999999999999981e98Initial program 47.8%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around inf 89.1%
if -3.59999999999999981e98 < t1 < 6.1999999999999999e73Initial program 82.9%
associate-/l*85.4%
Simplified85.4%
if 6.1999999999999999e73 < t1 Initial program 61.0%
times-frac100.0%
Simplified100.0%
clear-num98.8%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in t1 around inf 91.8%
associate-/r/92.3%
Applied egg-rr92.3%
Final simplification87.2%
(FPCore (u v t1) :precision binary64 (if (or (<= u -7.4e-56) (not (<= u 1.02e-28))) (/ (* t1 (/ v (+ t1 u))) (- t1 u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -7.4e-56) || !(u <= 1.02e-28)) {
tmp = (t1 * (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 <= (-7.4d-56)) .or. (.not. (u <= 1.02d-28))) then
tmp = (t1 * (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 <= -7.4e-56) || !(u <= 1.02e-28)) {
tmp = (t1 * (v / (t1 + u))) / (t1 - u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -7.4e-56) or not (u <= 1.02e-28): tmp = (t1 * (v / (t1 + u))) / (t1 - u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -7.4e-56) || !(u <= 1.02e-28)) tmp = Float64(Float64(t1 * Float64(v / Float64(t1 + u))) / 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 <= -7.4e-56) || ~((u <= 1.02e-28))) tmp = (t1 * (v / (t1 + u))) / (t1 - u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -7.4e-56], N[Not[LessEqual[u, 1.02e-28]], $MachinePrecision]], N[(N[(t1 * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t1 - u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -7.4 \cdot 10^{-56} \lor \neg \left(u \leq 1.02 \cdot 10^{-28}\right):\\
\;\;\;\;\frac{t1 \cdot \frac{v}{t1 + u}}{t1 - u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -7.4000000000000004e-56 or 1.01999999999999997e-28 < u Initial program 77.4%
associate-/l*79.6%
Simplified79.6%
associate-*r/77.4%
frac-times97.9%
frac-2neg97.9%
remove-double-neg97.9%
associate-*l/99.3%
distribute-neg-in99.3%
add-sqr-sqrt52.6%
sqrt-unprod82.5%
sqr-neg82.5%
sqrt-unprod37.3%
add-sqr-sqrt81.6%
sub-neg81.6%
Applied egg-rr81.6%
if -7.4000000000000004e-56 < u < 1.01999999999999997e-28Initial program 65.2%
associate-/l*63.2%
Simplified63.2%
Taylor expanded in t1 around inf 83.5%
associate-*r/83.5%
neg-mul-183.5%
Simplified83.5%
Final simplification82.3%
(FPCore (u v t1) :precision binary64 (if (or (<= u -5.2e-56) (not (<= u 6.2e-30))) (* (/ v (+ t1 u)) (/ (- t1) u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -5.2e-56) || !(u <= 6.2e-30)) {
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 <= (-5.2d-56)) .or. (.not. (u <= 6.2d-30))) 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 <= -5.2e-56) || !(u <= 6.2e-30)) {
tmp = (v / (t1 + u)) * (-t1 / u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -5.2e-56) or not (u <= 6.2e-30): tmp = (v / (t1 + u)) * (-t1 / u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -5.2e-56) || !(u <= 6.2e-30)) tmp = Float64(Float64(v / Float64(t1 + u)) * Float64(Float64(-t1) / u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -5.2e-56) || ~((u <= 6.2e-30))) tmp = (v / (t1 + u)) * (-t1 / u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -5.2e-56], N[Not[LessEqual[u, 6.2e-30]], $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 -5.2 \cdot 10^{-56} \lor \neg \left(u \leq 6.2 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{v}{t1 + u} \cdot \frac{-t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -5.19999999999999994e-56 or 6.19999999999999982e-30 < u Initial program 77.4%
times-frac97.9%
Simplified97.9%
Taylor expanded in t1 around 0 79.5%
associate-*r/79.5%
neg-mul-179.5%
Simplified79.5%
if -5.19999999999999994e-56 < u < 6.19999999999999982e-30Initial program 65.2%
associate-/l*63.2%
Simplified63.2%
Taylor expanded in t1 around inf 83.5%
associate-*r/83.5%
neg-mul-183.5%
Simplified83.5%
Final simplification81.1%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3.9e+133) (not (<= u 1.02e+75))) (/ t1 (* u (/ u v))) (/ (- v) (+ t1 u))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.9e+133) || !(u <= 1.02e+75)) {
tmp = t1 / (u * (u / v));
} else {
tmp = -v / (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 ((u <= (-3.9d+133)) .or. (.not. (u <= 1.02d+75))) then
tmp = t1 / (u * (u / v))
else
tmp = -v / (t1 + u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.9e+133) || !(u <= 1.02e+75)) {
tmp = t1 / (u * (u / v));
} else {
tmp = -v / (t1 + u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3.9e+133) or not (u <= 1.02e+75): tmp = t1 / (u * (u / v)) else: tmp = -v / (t1 + u) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3.9e+133) || !(u <= 1.02e+75)) tmp = Float64(t1 / Float64(u * Float64(u / v))); else tmp = Float64(Float64(-v) / Float64(t1 + u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3.9e+133) || ~((u <= 1.02e+75))) tmp = t1 / (u * (u / v)); else tmp = -v / (t1 + u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3.9e+133], N[Not[LessEqual[u, 1.02e+75]], $MachinePrecision]], N[(t1 / N[(u * N[(u / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.9 \cdot 10^{+133} \lor \neg \left(u \leq 1.02 \cdot 10^{+75}\right):\\
\;\;\;\;\frac{t1}{u \cdot \frac{u}{v}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\end{array}
\end{array}
if u < -3.90000000000000014e133 or 1.0200000000000001e75 < u Initial program 77.6%
times-frac96.5%
Simplified96.5%
Taylor expanded in t1 around 0 88.7%
associate-*r/88.7%
neg-mul-188.7%
Simplified88.7%
Taylor expanded in t1 around 0 88.8%
*-commutative88.8%
clear-num88.7%
frac-times84.5%
*-un-lft-identity84.5%
add-sqr-sqrt42.4%
sqrt-unprod63.3%
sqr-neg63.3%
sqrt-unprod34.7%
add-sqr-sqrt68.3%
Applied egg-rr68.3%
if -3.90000000000000014e133 < u < 1.0200000000000001e75Initial program 69.8%
times-frac98.8%
Simplified98.8%
Taylor expanded in t1 around inf 69.9%
Final simplification69.4%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.4e+178) (not (<= u 3.5e+143))) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.4e+178) || !(u <= 3.5e+143)) {
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 <= (-1.4d+178)) .or. (.not. (u <= 3.5d+143))) 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 <= -1.4e+178) || !(u <= 3.5e+143)) {
tmp = v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.4e+178) or not (u <= 3.5e+143): tmp = v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.4e+178) || !(u <= 3.5e+143)) 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 <= -1.4e+178) || ~((u <= 3.5e+143))) tmp = v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.4e+178], N[Not[LessEqual[u, 3.5e+143]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.4 \cdot 10^{+178} \lor \neg \left(u \leq 3.5 \cdot 10^{+143}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -1.39999999999999997e178 or 3.50000000000000008e143 < u Initial program 77.8%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 96.4%
associate-*r/96.4%
neg-mul-196.4%
Simplified96.4%
associate-*r/96.3%
frac-2neg96.3%
add-sqr-sqrt51.9%
sqrt-unprod76.9%
sqr-neg76.9%
sqrt-unprod42.1%
add-sqr-sqrt77.9%
distribute-lft-neg-out77.9%
distribute-frac-neg77.9%
*-commutative77.9%
add-sqr-sqrt35.8%
sqrt-unprod64.1%
sqr-neg64.1%
sqrt-unprod44.4%
add-sqr-sqrt96.3%
distribute-neg-in96.3%
add-sqr-sqrt51.9%
sqrt-unprod90.5%
sqr-neg90.5%
sqrt-unprod44.6%
add-sqr-sqrt96.4%
sub-neg96.4%
Applied egg-rr96.4%
associate-/l*85.8%
Simplified85.8%
Taylor expanded in t1 around inf 46.1%
if -1.39999999999999997e178 < u < 3.50000000000000008e143Initial program 70.8%
associate-/l*70.9%
Simplified70.9%
Taylor expanded in t1 around inf 64.5%
associate-*r/64.5%
neg-mul-164.5%
Simplified64.5%
Final simplification60.2%
(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 72.4%
times-frac98.0%
Simplified98.0%
Taylor expanded in t1 around inf 61.2%
Final simplification61.2%
(FPCore (u v t1) :precision binary64 (/ v u))
double code(double u, double v, double t1) {
return v / 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 / u
end function
public static double code(double u, double v, double t1) {
return v / u;
}
def code(u, v, t1): return v / u
function code(u, v, t1) return Float64(v / u) end
function tmp = code(u, v, t1) tmp = v / u; end
code[u_, v_, t1_] := N[(v / u), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u}
\end{array}
Initial program 72.4%
times-frac98.0%
Simplified98.0%
Taylor expanded in t1 around 0 55.5%
associate-*r/55.5%
neg-mul-155.5%
Simplified55.5%
associate-*r/51.7%
frac-2neg51.7%
add-sqr-sqrt25.9%
sqrt-unprod32.0%
sqr-neg32.0%
sqrt-unprod14.7%
add-sqr-sqrt31.7%
distribute-lft-neg-out31.7%
distribute-frac-neg31.7%
*-commutative31.7%
add-sqr-sqrt16.9%
sqrt-unprod31.0%
sqr-neg31.0%
sqrt-unprod25.7%
add-sqr-sqrt51.7%
distribute-neg-in51.7%
add-sqr-sqrt25.9%
sqrt-unprod54.2%
sqr-neg54.2%
sqrt-unprod24.6%
add-sqr-sqrt52.3%
sub-neg52.3%
Applied egg-rr52.3%
associate-/l*49.4%
Simplified49.4%
Taylor expanded in t1 around inf 18.8%
Final simplification18.8%
herbie shell --seed 2024036
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))