
(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 13 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) (- (- u) t1)))
double code(double u, double v, double t1) {
return ((t1 / (t1 + u)) * 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 = ((t1 / (t1 + u)) * v) / (-u - t1)
end function
public static double code(double u, double v, double t1) {
return ((t1 / (t1 + u)) * v) / (-u - t1);
}
def code(u, v, t1): return ((t1 / (t1 + u)) * v) / (-u - t1)
function code(u, v, t1) return Float64(Float64(Float64(t1 / Float64(t1 + u)) * v) / Float64(Float64(-u) - t1)) end
function tmp = code(u, v, t1) tmp = ((t1 / (t1 + u)) * v) / (-u - t1); end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision] / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t1}{t1 + u} \cdot v}{\left(-u\right) - t1}
\end{array}
Initial program 72.4%
associate-/l*73.6%
distribute-lft-neg-out73.6%
distribute-rgt-neg-in73.6%
associate-/r*85.8%
distribute-neg-frac285.8%
Simplified85.8%
associate-*r/99.2%
+-commutative99.2%
distribute-neg-in99.2%
sub-neg99.2%
associate-*l/98.8%
frac-2neg98.8%
associate-*r/98.8%
sub-neg98.8%
distribute-neg-in98.8%
+-commutative98.8%
remove-double-neg98.8%
frac-2neg98.8%
add-sqr-sqrt49.3%
sqrt-unprod46.8%
sqr-neg46.8%
sqrt-unprod20.8%
add-sqr-sqrt38.5%
add-sqr-sqrt21.8%
sqrt-unprod56.6%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (+ t1 u))))
(if (<= t1 -1.32e+104)
(* t_1 (+ (/ u t1) -1.0))
(if (<= t1 1.05e+107) (* t1 (/ t_1 (- (- u) t1))) (/ v (- t1))))))
double code(double u, double v, double t1) {
double t_1 = v / (t1 + u);
double tmp;
if (t1 <= -1.32e+104) {
tmp = t_1 * ((u / t1) + -1.0);
} else if (t1 <= 1.05e+107) {
tmp = t1 * (t_1 / (-u - t1));
} 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) :: t_1
real(8) :: tmp
t_1 = v / (t1 + u)
if (t1 <= (-1.32d+104)) then
tmp = t_1 * ((u / t1) + (-1.0d0))
else if (t1 <= 1.05d+107) then
tmp = t1 * (t_1 / (-u - t1))
else
tmp = v / -t1
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.32e+104) {
tmp = t_1 * ((u / t1) + -1.0);
} else if (t1 <= 1.05e+107) {
tmp = t1 * (t_1 / (-u - t1));
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): t_1 = v / (t1 + u) tmp = 0 if t1 <= -1.32e+104: tmp = t_1 * ((u / t1) + -1.0) elif t1 <= 1.05e+107: tmp = t1 * (t_1 / (-u - t1)) else: tmp = v / -t1 return tmp
function code(u, v, t1) t_1 = Float64(v / Float64(t1 + u)) tmp = 0.0 if (t1 <= -1.32e+104) tmp = Float64(t_1 * Float64(Float64(u / t1) + -1.0)); elseif (t1 <= 1.05e+107) tmp = Float64(t1 * Float64(t_1 / Float64(Float64(-u) - t1))); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v / (t1 + u); tmp = 0.0; if (t1 <= -1.32e+104) tmp = t_1 * ((u / t1) + -1.0); elseif (t1 <= 1.05e+107) tmp = t1 * (t_1 / (-u - t1)); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.32e+104], N[(t$95$1 * N[(N[(u / t1), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.05e+107], N[(t1 * N[(t$95$1 / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{t1 + u}\\
\mathbf{if}\;t1 \leq -1.32 \cdot 10^{+104}:\\
\;\;\;\;t\_1 \cdot \left(\frac{u}{t1} + -1\right)\\
\mathbf{elif}\;t1 \leq 1.05 \cdot 10^{+107}:\\
\;\;\;\;t1 \cdot \frac{t\_1}{\left(-u\right) - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if t1 < -1.32000000000000003e104Initial program 49.2%
times-frac99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t1 around inf 97.7%
if -1.32000000000000003e104 < t1 < 1.05e107Initial program 81.9%
associate-/l*85.8%
distribute-lft-neg-out85.8%
distribute-rgt-neg-in85.8%
associate-/r*92.7%
distribute-neg-frac292.7%
Simplified92.7%
if 1.05e107 < t1 Initial program 51.5%
associate-/l*47.4%
distribute-lft-neg-out47.4%
distribute-rgt-neg-in47.4%
associate-/r*73.5%
distribute-neg-frac273.5%
Simplified73.5%
Taylor expanded in t1 around inf 89.3%
associate-*r/89.3%
neg-mul-189.3%
Simplified89.3%
Final simplification93.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (- u) t1)))
(if (or (<= t1 -4.2e-96) (not (<= t1 200.0)))
(/ v t_1)
(* v (/ (/ t1 u) t_1)))))
double code(double u, double v, double t1) {
double t_1 = -u - t1;
double tmp;
if ((t1 <= -4.2e-96) || !(t1 <= 200.0)) {
tmp = v / t_1;
} else {
tmp = v * ((t1 / u) / t_1);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = -u - t1
if ((t1 <= (-4.2d-96)) .or. (.not. (t1 <= 200.0d0))) then
tmp = v / t_1
else
tmp = v * ((t1 / u) / t_1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -u - t1;
double tmp;
if ((t1 <= -4.2e-96) || !(t1 <= 200.0)) {
tmp = v / t_1;
} else {
tmp = v * ((t1 / u) / t_1);
}
return tmp;
}
def code(u, v, t1): t_1 = -u - t1 tmp = 0 if (t1 <= -4.2e-96) or not (t1 <= 200.0): tmp = v / t_1 else: tmp = v * ((t1 / u) / t_1) return tmp
function code(u, v, t1) t_1 = Float64(Float64(-u) - t1) tmp = 0.0 if ((t1 <= -4.2e-96) || !(t1 <= 200.0)) tmp = Float64(v / t_1); else tmp = Float64(v * Float64(Float64(t1 / u) / t_1)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -u - t1; tmp = 0.0; if ((t1 <= -4.2e-96) || ~((t1 <= 200.0))) tmp = v / t_1; else tmp = v * ((t1 / u) / t_1); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-u) - t1), $MachinePrecision]}, If[Or[LessEqual[t1, -4.2e-96], N[Not[LessEqual[t1, 200.0]], $MachinePrecision]], N[(v / t$95$1), $MachinePrecision], N[(v * N[(N[(t1 / u), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-u\right) - t1\\
\mathbf{if}\;t1 \leq -4.2 \cdot 10^{-96} \lor \neg \left(t1 \leq 200\right):\\
\;\;\;\;\frac{v}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;v \cdot \frac{\frac{t1}{u}}{t\_1}\\
\end{array}
\end{array}
if t1 < -4.20000000000000002e-96 or 200 < t1 Initial program 65.6%
associate-/l*64.3%
distribute-lft-neg-out64.3%
distribute-rgt-neg-in64.3%
associate-/r*82.0%
distribute-neg-frac282.0%
Simplified82.0%
associate-*r/99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*l/99.9%
frac-2neg99.9%
associate-*r/99.9%
sub-neg99.9%
distribute-neg-in99.9%
+-commutative99.9%
remove-double-neg99.9%
frac-2neg99.9%
add-sqr-sqrt60.8%
sqrt-unprod46.3%
sqr-neg46.3%
sqrt-unprod15.1%
add-sqr-sqrt34.6%
add-sqr-sqrt18.5%
sqrt-unprod46.3%
Applied egg-rr99.9%
Taylor expanded in t1 around inf 81.8%
mul-1-neg81.8%
Simplified81.8%
if -4.20000000000000002e-96 < t1 < 200Initial program 81.1%
associate-/l*85.6%
distribute-lft-neg-out85.6%
distribute-rgt-neg-in85.6%
associate-/r*90.6%
distribute-neg-frac290.6%
Simplified90.6%
Taylor expanded in t1 around 0 78.6%
Taylor expanded in v around 0 74.2%
neg-mul-174.2%
distribute-neg-frac74.2%
Simplified74.2%
*-commutative74.2%
associate-*l/68.1%
add-sqr-sqrt36.1%
sqrt-unprod51.0%
sqr-neg51.0%
sqrt-unprod22.1%
add-sqr-sqrt46.6%
Applied egg-rr46.6%
frac-2neg46.6%
distribute-frac-neg46.6%
add-sqr-sqrt22.1%
sqrt-unprod51.0%
sqr-neg51.0%
sqrt-unprod36.1%
add-sqr-sqrt68.1%
distribute-lft-neg-in68.1%
frac-2neg68.1%
associate-/l*73.0%
associate-/r*81.3%
Applied egg-rr81.3%
Final simplification81.6%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.95e-97) (/ v (- (- u) t1)) (if (<= t1 7.2e+42) (/ (* v (/ t1 (- u))) (+ t1 u)) (/ v (- t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.95e-97) {
tmp = v / (-u - t1);
} else if (t1 <= 7.2e+42) {
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 (t1 <= (-1.95d-97)) then
tmp = v / (-u - t1)
else if (t1 <= 7.2d+42) 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 (t1 <= -1.95e-97) {
tmp = v / (-u - t1);
} else if (t1 <= 7.2e+42) {
tmp = (v * (t1 / -u)) / (t1 + u);
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.95e-97: tmp = v / (-u - t1) elif t1 <= 7.2e+42: tmp = (v * (t1 / -u)) / (t1 + u) else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.95e-97) tmp = Float64(v / Float64(Float64(-u) - t1)); elseif (t1 <= 7.2e+42) tmp = Float64(Float64(v * Float64(t1 / Float64(-u))) / Float64(t1 + u)); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.95e-97) tmp = v / (-u - t1); elseif (t1 <= 7.2e+42) tmp = (v * (t1 / -u)) / (t1 + u); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.95e-97], N[(v / N[((-u) - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 7.2e+42], 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}\;t1 \leq -1.95 \cdot 10^{-97}:\\
\;\;\;\;\frac{v}{\left(-u\right) - t1}\\
\mathbf{elif}\;t1 \leq 7.2 \cdot 10^{+42}:\\
\;\;\;\;\frac{v \cdot \frac{t1}{-u}}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if t1 < -1.9499999999999999e-97Initial program 67.3%
associate-/l*66.7%
distribute-lft-neg-out66.7%
distribute-rgt-neg-in66.7%
associate-/r*82.1%
distribute-neg-frac282.1%
Simplified82.1%
associate-*r/99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*l/99.9%
frac-2neg99.9%
associate-*r/99.9%
sub-neg99.9%
distribute-neg-in99.9%
+-commutative99.9%
remove-double-neg99.9%
frac-2neg99.9%
add-sqr-sqrt99.4%
sqrt-unprod63.2%
sqr-neg63.2%
sqrt-unprod0.0%
add-sqr-sqrt31.9%
add-sqr-sqrt23.2%
sqrt-unprod34.1%
Applied egg-rr99.9%
Taylor expanded in t1 around inf 81.9%
mul-1-neg81.9%
Simplified81.9%
if -1.9499999999999999e-97 < t1 < 7.2000000000000002e42Initial program 80.6%
associate-/l*84.7%
distribute-lft-neg-out84.7%
distribute-rgt-neg-in84.7%
associate-/r*90.7%
distribute-neg-frac290.7%
Simplified90.7%
associate-*r/98.3%
+-commutative98.3%
distribute-neg-in98.3%
sub-neg98.3%
associate-*l/97.6%
frac-2neg97.6%
associate-*r/97.6%
sub-neg97.6%
distribute-neg-in97.6%
+-commutative97.6%
remove-double-neg97.6%
frac-2neg97.6%
add-sqr-sqrt31.6%
sqrt-unprod47.6%
sqr-neg47.6%
sqrt-unprod29.8%
add-sqr-sqrt43.9%
add-sqr-sqrt27.8%
sqrt-unprod70.2%
Applied egg-rr97.6%
Taylor expanded in t1 around 0 81.5%
if 7.2000000000000002e42 < t1 Initial program 60.0%
associate-/l*56.8%
distribute-lft-neg-out56.8%
distribute-rgt-neg-in56.8%
associate-/r*79.3%
distribute-neg-frac279.3%
Simplified79.3%
Taylor expanded in t1 around inf 85.5%
associate-*r/85.5%
neg-mul-185.5%
Simplified85.5%
Final simplification82.3%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.56e-99) (/ v (- (- u) t1)) (if (<= t1 2.2e+43) (* (/ v (+ t1 u)) (/ t1 (- u))) (/ v (- t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.56e-99) {
tmp = v / (-u - t1);
} else if (t1 <= 2.2e+43) {
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 (t1 <= (-1.56d-99)) then
tmp = v / (-u - t1)
else if (t1 <= 2.2d+43) 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 (t1 <= -1.56e-99) {
tmp = v / (-u - t1);
} else if (t1 <= 2.2e+43) {
tmp = (v / (t1 + u)) * (t1 / -u);
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.56e-99: tmp = v / (-u - t1) elif t1 <= 2.2e+43: tmp = (v / (t1 + u)) * (t1 / -u) else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.56e-99) tmp = Float64(v / Float64(Float64(-u) - t1)); elseif (t1 <= 2.2e+43) 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 (t1 <= -1.56e-99) tmp = v / (-u - t1); elseif (t1 <= 2.2e+43) tmp = (v / (t1 + u)) * (t1 / -u); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.56e-99], N[(v / N[((-u) - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 2.2e+43], 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}\;t1 \leq -1.56 \cdot 10^{-99}:\\
\;\;\;\;\frac{v}{\left(-u\right) - t1}\\
\mathbf{elif}\;t1 \leq 2.2 \cdot 10^{+43}:\\
\;\;\;\;\frac{v}{t1 + u} \cdot \frac{t1}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if t1 < -1.55999999999999991e-99Initial program 67.3%
associate-/l*66.7%
distribute-lft-neg-out66.7%
distribute-rgt-neg-in66.7%
associate-/r*82.1%
distribute-neg-frac282.1%
Simplified82.1%
associate-*r/99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*l/99.9%
frac-2neg99.9%
associate-*r/99.9%
sub-neg99.9%
distribute-neg-in99.9%
+-commutative99.9%
remove-double-neg99.9%
frac-2neg99.9%
add-sqr-sqrt99.4%
sqrt-unprod63.2%
sqr-neg63.2%
sqrt-unprod0.0%
add-sqr-sqrt31.9%
add-sqr-sqrt23.2%
sqrt-unprod34.1%
Applied egg-rr99.9%
Taylor expanded in t1 around inf 81.9%
mul-1-neg81.9%
Simplified81.9%
if -1.55999999999999991e-99 < t1 < 2.20000000000000001e43Initial program 80.6%
times-frac97.6%
distribute-frac-neg97.6%
distribute-neg-frac297.6%
+-commutative97.6%
distribute-neg-in97.6%
unsub-neg97.6%
Simplified97.6%
Taylor expanded in t1 around 0 81.5%
associate-*r/81.5%
mul-1-neg81.5%
Simplified81.5%
if 2.20000000000000001e43 < t1 Initial program 60.0%
associate-/l*56.8%
distribute-lft-neg-out56.8%
distribute-rgt-neg-in56.8%
associate-/r*79.3%
distribute-neg-frac279.3%
Simplified79.3%
Taylor expanded in t1 around inf 85.5%
associate-*r/85.5%
neg-mul-185.5%
Simplified85.5%
Final simplification82.3%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2.8e+57) (not (<= u 2.2e+107))) (/ t1 (* (+ t1 u) (/ u v))) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2.8e+57) || !(u <= 2.2e+107)) {
tmp = t1 / ((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 <= (-2.8d+57)) .or. (.not. (u <= 2.2d+107))) then
tmp = t1 / ((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 <= -2.8e+57) || !(u <= 2.2e+107)) {
tmp = t1 / ((t1 + u) * (u / v));
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2.8e+57) or not (u <= 2.2e+107): tmp = t1 / ((t1 + u) * (u / v)) else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2.8e+57) || !(u <= 2.2e+107)) tmp = Float64(t1 / Float64(Float64(t1 + u) * Float64(u / v))); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -2.8e+57) || ~((u <= 2.2e+107))) tmp = t1 / ((t1 + u) * (u / v)); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2.8e+57], N[Not[LessEqual[u, 2.2e+107]], $MachinePrecision]], N[(t1 / N[(N[(t1 + u), $MachinePrecision] * N[(u / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.8 \cdot 10^{+57} \lor \neg \left(u \leq 2.2 \cdot 10^{+107}\right):\\
\;\;\;\;\frac{t1}{\left(t1 + u\right) \cdot \frac{u}{v}}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -2.8e57 or 2.2e107 < u Initial program 76.5%
associate-/l*75.4%
distribute-lft-neg-out75.4%
distribute-rgt-neg-in75.4%
associate-/r*89.4%
distribute-neg-frac289.4%
Simplified89.4%
Taylor expanded in t1 around 0 84.9%
clear-num84.7%
un-div-inv84.8%
div-inv84.7%
add-sqr-sqrt50.5%
sqrt-unprod74.6%
sqr-neg74.6%
sqrt-unprod28.4%
add-sqr-sqrt70.5%
clear-num70.5%
Applied egg-rr70.5%
if -2.8e57 < u < 2.2e107Initial program 69.7%
associate-/l*72.4%
distribute-lft-neg-out72.4%
distribute-rgt-neg-in72.4%
associate-/r*83.3%
distribute-neg-frac283.3%
Simplified83.3%
Taylor expanded in t1 around inf 70.4%
associate-*r/70.4%
neg-mul-170.4%
Simplified70.4%
Final simplification70.4%
(FPCore (u v t1) :precision binary64 (if (or (<= u -4.9e+54) (not (<= u 2.15e+107))) (* (/ v (+ t1 u)) (/ t1 u)) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -4.9e+54) || !(u <= 2.15e+107)) {
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 <= (-4.9d+54)) .or. (.not. (u <= 2.15d+107))) 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 <= -4.9e+54) || !(u <= 2.15e+107)) {
tmp = (v / (t1 + u)) * (t1 / u);
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -4.9e+54) or not (u <= 2.15e+107): tmp = (v / (t1 + u)) * (t1 / u) else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -4.9e+54) || !(u <= 2.15e+107)) tmp = Float64(Float64(v / Float64(t1 + u)) * Float64(t1 / u)); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -4.9e+54) || ~((u <= 2.15e+107))) tmp = (v / (t1 + u)) * (t1 / u); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -4.9e+54], N[Not[LessEqual[u, 2.15e+107]], $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 -4.9 \cdot 10^{+54} \lor \neg \left(u \leq 2.15 \cdot 10^{+107}\right):\\
\;\;\;\;\frac{v}{t1 + u} \cdot \frac{t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -4.90000000000000001e54 or 2.15e107 < u Initial program 76.5%
associate-/l*75.4%
distribute-lft-neg-out75.4%
distribute-rgt-neg-in75.4%
associate-/r*89.4%
distribute-neg-frac289.4%
Simplified89.4%
Taylor expanded in t1 around 0 84.9%
associate-*r/87.3%
clear-num87.3%
add-sqr-sqrt51.4%
sqrt-unprod74.6%
sqr-neg74.6%
sqrt-unprod27.5%
add-sqr-sqrt69.3%
Applied egg-rr69.3%
associate-/r/68.7%
associate-*r*68.7%
associate-*l/68.7%
*-lft-identity68.7%
times-frac70.2%
*-commutative70.2%
times-frac70.3%
Simplified70.3%
if -4.90000000000000001e54 < u < 2.15e107Initial program 69.7%
associate-/l*72.4%
distribute-lft-neg-out72.4%
distribute-rgt-neg-in72.4%
associate-/r*83.3%
distribute-neg-frac283.3%
Simplified83.3%
Taylor expanded in t1 around inf 70.4%
associate-*r/70.4%
neg-mul-170.4%
Simplified70.4%
Final simplification70.4%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3.4e+128) (not (<= u 4.7e+132))) (/ v (- u)) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.4e+128) || !(u <= 4.7e+132)) {
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 <= (-3.4d+128)) .or. (.not. (u <= 4.7d+132))) 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 <= -3.4e+128) || !(u <= 4.7e+132)) {
tmp = v / -u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3.4e+128) or not (u <= 4.7e+132): tmp = v / -u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3.4e+128) || !(u <= 4.7e+132)) tmp = Float64(v / Float64(-u)); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3.4e+128) || ~((u <= 4.7e+132))) tmp = v / -u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3.4e+128], N[Not[LessEqual[u, 4.7e+132]], $MachinePrecision]], N[(v / (-u)), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.4 \cdot 10^{+128} \lor \neg \left(u \leq 4.7 \cdot 10^{+132}\right):\\
\;\;\;\;\frac{v}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -3.3999999999999999e128 or 4.7e132 < u Initial program 75.5%
associate-/l*74.8%
distribute-lft-neg-out74.8%
distribute-rgt-neg-in74.8%
associate-/r*91.7%
distribute-neg-frac291.7%
Simplified91.7%
Taylor expanded in t1 around 0 88.3%
Taylor expanded in t1 around inf 40.1%
associate-*r/40.1%
mul-1-neg40.1%
Simplified40.1%
if -3.3999999999999999e128 < u < 4.7e132Initial program 71.0%
associate-/l*73.1%
distribute-lft-neg-out73.1%
distribute-rgt-neg-in73.1%
associate-/r*83.1%
distribute-neg-frac283.1%
Simplified83.1%
Taylor expanded in t1 around inf 67.5%
associate-*r/67.5%
neg-mul-167.5%
Simplified67.5%
Final simplification59.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -9e+133) (not (<= u 6e+133))) (/ v u) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -9e+133) || !(u <= 6e+133)) {
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 <= (-9d+133)) .or. (.not. (u <= 6d+133))) 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 <= -9e+133) || !(u <= 6e+133)) {
tmp = v / u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -9e+133) or not (u <= 6e+133): tmp = v / u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -9e+133) || !(u <= 6e+133)) 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 <= -9e+133) || ~((u <= 6e+133))) tmp = v / u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -9e+133], N[Not[LessEqual[u, 6e+133]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -9 \cdot 10^{+133} \lor \neg \left(u \leq 6 \cdot 10^{+133}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -8.9999999999999997e133 or 6.00000000000000013e133 < u Initial program 75.2%
associate-/l*74.5%
distribute-lft-neg-out74.5%
distribute-rgt-neg-in74.5%
associate-/r*91.6%
distribute-neg-frac291.6%
Simplified91.6%
Taylor expanded in t1 around 0 88.1%
Taylor expanded in v around 0 74.6%
neg-mul-174.6%
distribute-neg-frac74.6%
Simplified74.6%
*-commutative74.6%
associate-*l/74.1%
add-sqr-sqrt40.3%
sqrt-unprod64.5%
sqr-neg64.5%
sqrt-unprod32.5%
add-sqr-sqrt72.7%
Applied egg-rr72.7%
Taylor expanded in t1 around inf 40.2%
if -8.9999999999999997e133 < u < 6.00000000000000013e133Initial program 71.2%
associate-/l*73.2%
distribute-lft-neg-out73.2%
distribute-rgt-neg-in73.2%
associate-/r*83.2%
distribute-neg-frac283.2%
Simplified83.2%
Taylor expanded in t1 around inf 67.1%
associate-*r/67.1%
neg-mul-167.1%
Simplified67.1%
Final simplification58.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -6.5e+101) (not (<= t1 1.85e+67))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -6.5e+101) || !(t1 <= 1.85e+67)) {
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 <= (-6.5d+101)) .or. (.not. (t1 <= 1.85d+67))) 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 <= -6.5e+101) || !(t1 <= 1.85e+67)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -6.5e+101) or not (t1 <= 1.85e+67): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -6.5e+101) || !(t1 <= 1.85e+67)) 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 <= -6.5e+101) || ~((t1 <= 1.85e+67))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -6.5e+101], N[Not[LessEqual[t1, 1.85e+67]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -6.5 \cdot 10^{+101} \lor \neg \left(t1 \leq 1.85 \cdot 10^{+67}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -6.50000000000000016e101 or 1.8499999999999999e67 < t1 Initial program 52.1%
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 92.8%
Taylor expanded in u around inf 34.2%
if -6.50000000000000016e101 < t1 < 1.8499999999999999e67Initial program 82.0%
associate-/l*86.0%
distribute-lft-neg-out86.0%
distribute-rgt-neg-in86.0%
associate-/r*92.5%
distribute-neg-frac292.5%
Simplified92.5%
Taylor expanded in t1 around 0 68.5%
Taylor expanded in v around 0 62.5%
neg-mul-162.5%
distribute-neg-frac62.5%
Simplified62.5%
*-commutative62.5%
associate-*l/58.8%
add-sqr-sqrt31.8%
sqrt-unprod45.3%
sqr-neg45.3%
sqrt-unprod19.2%
add-sqr-sqrt42.1%
Applied egg-rr42.1%
Taylor expanded in t1 around inf 20.9%
Final simplification25.2%
(FPCore (u v t1) :precision binary64 (* (/ t1 (+ t1 u)) (/ v (- (- u) t1))))
double code(double u, double v, double t1) {
return (t1 / (t1 + u)) * (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 = (t1 / (t1 + u)) * (v / (-u - t1))
end function
public static double code(double u, double v, double t1) {
return (t1 / (t1 + u)) * (v / (-u - t1));
}
def code(u, v, t1): return (t1 / (t1 + u)) * (v / (-u - t1))
function code(u, v, t1) return Float64(Float64(t1 / Float64(t1 + u)) * Float64(v / Float64(Float64(-u) - t1))) end
function tmp = code(u, v, t1) tmp = (t1 / (t1 + u)) * (v / (-u - t1)); end
code[u_, v_, t1_] := N[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(v / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t1}{t1 + u} \cdot \frac{v}{\left(-u\right) - t1}
\end{array}
Initial program 72.4%
times-frac98.8%
distribute-frac-neg98.8%
distribute-neg-frac298.8%
+-commutative98.8%
distribute-neg-in98.8%
unsub-neg98.8%
Simplified98.8%
Final simplification98.8%
(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(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}{\left(-u\right) - t1}
\end{array}
Initial program 72.4%
associate-/l*73.6%
distribute-lft-neg-out73.6%
distribute-rgt-neg-in73.6%
associate-/r*85.8%
distribute-neg-frac285.8%
Simplified85.8%
associate-*r/99.2%
+-commutative99.2%
distribute-neg-in99.2%
sub-neg99.2%
associate-*l/98.8%
frac-2neg98.8%
associate-*r/98.8%
sub-neg98.8%
distribute-neg-in98.8%
+-commutative98.8%
remove-double-neg98.8%
frac-2neg98.8%
add-sqr-sqrt49.3%
sqrt-unprod46.8%
sqr-neg46.8%
sqrt-unprod20.8%
add-sqr-sqrt38.5%
add-sqr-sqrt21.8%
sqrt-unprod56.6%
Applied egg-rr98.8%
Taylor expanded in t1 around inf 61.5%
mul-1-neg61.5%
Simplified61.5%
Final simplification61.5%
(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.4%
times-frac98.8%
distribute-frac-neg98.8%
distribute-neg-frac298.8%
+-commutative98.8%
distribute-neg-in98.8%
unsub-neg98.8%
Simplified98.8%
Taylor expanded in t1 around inf 55.6%
Taylor expanded in u around inf 13.0%
herbie shell --seed 2024088
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))