
(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 9 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)) (- -1.0 (/ u t1))))
double code(double u, double v, double t1) {
return (v / (t1 + u)) / (-1.0 - (u / t1));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (v / (t1 + u)) / ((-1.0d0) - (u / t1))
end function
public static double code(double u, double v, double t1) {
return (v / (t1 + u)) / (-1.0 - (u / t1));
}
def code(u, v, t1): return (v / (t1 + u)) / (-1.0 - (u / t1))
function code(u, v, t1) return Float64(Float64(v / Float64(t1 + u)) / Float64(-1.0 - Float64(u / t1))) end
function tmp = code(u, v, t1) tmp = (v / (t1 + u)) / (-1.0 - (u / t1)); end
code[u_, v_, t1_] := N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{t1 + u}}{-1 - \frac{u}{t1}}
\end{array}
Initial program 75.1%
*-commutative75.1%
times-frac99.2%
neg-mul-199.2%
associate-/l*99.2%
associate-*r/99.2%
associate-/l*99.2%
associate-/l/99.2%
neg-mul-199.2%
*-lft-identity99.2%
metadata-eval99.2%
times-frac99.2%
neg-mul-199.2%
remove-double-neg99.2%
neg-mul-199.2%
sub0-neg99.2%
associate--r+99.2%
neg-sub099.2%
div-sub99.2%
distribute-frac-neg99.2%
*-inverses99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (u v t1)
:precision binary64
(if (or (<= t1 -9.2e+124)
(not (or (<= t1 -7.2e+84) (and (not (<= t1 -6.5e-33)) (<= t1 1e-6)))))
(/ (- v) (+ t1 u))
(* (/ t1 u) (/ (- v) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -9.2e+124) || !((t1 <= -7.2e+84) || (!(t1 <= -6.5e-33) && (t1 <= 1e-6)))) {
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 <= (-9.2d+124)) .or. (.not. (t1 <= (-7.2d+84)) .or. (.not. (t1 <= (-6.5d-33))) .and. (t1 <= 1d-6))) 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 <= -9.2e+124) || !((t1 <= -7.2e+84) || (!(t1 <= -6.5e-33) && (t1 <= 1e-6)))) {
tmp = -v / (t1 + u);
} else {
tmp = (t1 / u) * (-v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -9.2e+124) or not ((t1 <= -7.2e+84) or (not (t1 <= -6.5e-33) and (t1 <= 1e-6))): tmp = -v / (t1 + u) else: tmp = (t1 / u) * (-v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -9.2e+124) || !((t1 <= -7.2e+84) || (!(t1 <= -6.5e-33) && (t1 <= 1e-6)))) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = Float64(Float64(t1 / u) * Float64(Float64(-v) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -9.2e+124) || ~(((t1 <= -7.2e+84) || (~((t1 <= -6.5e-33)) && (t1 <= 1e-6))))) tmp = -v / (t1 + u); else tmp = (t1 / u) * (-v / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -9.2e+124], N[Not[Or[LessEqual[t1, -7.2e+84], And[N[Not[LessEqual[t1, -6.5e-33]], $MachinePrecision], LessEqual[t1, 1e-6]]]], $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 -9.2 \cdot 10^{+124} \lor \neg \left(t1 \leq -7.2 \cdot 10^{+84} \lor \neg \left(t1 \leq -6.5 \cdot 10^{-33}\right) \land t1 \leq 10^{-6}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{-v}{u}\\
\end{array}
\end{array}
if t1 < -9.19999999999999938e124 or -7.1999999999999999e84 < t1 < -6.4999999999999993e-33 or 9.99999999999999955e-7 < t1 Initial program 65.7%
*-commutative65.7%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/100.0%
associate-/l*100.0%
associate-/l/100.0%
neg-mul-1100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate--r+100.0%
neg-sub0100.0%
div-sub100.0%
distribute-frac-neg100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t1 around inf 88.4%
Taylor expanded in v around 0 88.4%
associate-*r/88.4%
neg-mul-188.4%
Simplified88.4%
Taylor expanded in t1 around 0 88.4%
+-commutative88.4%
Simplified88.4%
if -9.19999999999999938e124 < t1 < -7.1999999999999999e84 or -6.4999999999999993e-33 < t1 < 9.99999999999999955e-7Initial program 83.8%
times-frac98.5%
Simplified98.5%
Taylor expanded in t1 around 0 82.1%
Taylor expanded in t1 around 0 85.4%
mul-1-neg85.4%
Simplified85.4%
Final simplification86.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))) (t_2 (* (/ t1 u) (/ (- v) u))))
(if (<= t1 -9.2e+124)
t_1
(if (<= t1 -7.2e+84)
t_2
(if (<= t1 -3.65e-109)
(/ (/ v t1) (- -1.0 (/ u t1)))
(if (<= t1 3e-7) t_2 t_1))))))
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 <= -9.2e+124) {
tmp = t_1;
} else if (t1 <= -7.2e+84) {
tmp = t_2;
} else if (t1 <= -3.65e-109) {
tmp = (v / t1) / (-1.0 - (u / t1));
} else if (t1 <= 3e-7) {
tmp = t_2;
} else {
tmp = 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) :: t_2
real(8) :: tmp
t_1 = -v / (t1 + u)
t_2 = (t1 / u) * (-v / u)
if (t1 <= (-9.2d+124)) then
tmp = t_1
else if (t1 <= (-7.2d+84)) then
tmp = t_2
else if (t1 <= (-3.65d-109)) then
tmp = (v / t1) / ((-1.0d0) - (u / t1))
else if (t1 <= 3d-7) then
tmp = t_2
else
tmp = t_1
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 <= -9.2e+124) {
tmp = t_1;
} else if (t1 <= -7.2e+84) {
tmp = t_2;
} else if (t1 <= -3.65e-109) {
tmp = (v / t1) / (-1.0 - (u / t1));
} else if (t1 <= 3e-7) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) t_2 = (t1 / u) * (-v / u) tmp = 0 if t1 <= -9.2e+124: tmp = t_1 elif t1 <= -7.2e+84: tmp = t_2 elif t1 <= -3.65e-109: tmp = (v / t1) / (-1.0 - (u / t1)) elif t1 <= 3e-7: tmp = t_2 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) t_2 = Float64(Float64(t1 / u) * Float64(Float64(-v) / u)) tmp = 0.0 if (t1 <= -9.2e+124) tmp = t_1; elseif (t1 <= -7.2e+84) tmp = t_2; elseif (t1 <= -3.65e-109) tmp = Float64(Float64(v / t1) / Float64(-1.0 - Float64(u / t1))); elseif (t1 <= 3e-7) tmp = t_2; else tmp = t_1; 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 <= -9.2e+124) tmp = t_1; elseif (t1 <= -7.2e+84) tmp = t_2; elseif (t1 <= -3.65e-109) tmp = (v / t1) / (-1.0 - (u / t1)); elseif (t1 <= 3e-7) tmp = t_2; else tmp = t_1; 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, -9.2e+124], t$95$1, If[LessEqual[t1, -7.2e+84], t$95$2, If[LessEqual[t1, -3.65e-109], N[(N[(v / t1), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 3e-7], t$95$2, t$95$1]]]]]]
\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 -9.2 \cdot 10^{+124}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t1 \leq -7.2 \cdot 10^{+84}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t1 \leq -3.65 \cdot 10^{-109}:\\
\;\;\;\;\frac{\frac{v}{t1}}{-1 - \frac{u}{t1}}\\
\mathbf{elif}\;t1 \leq 3 \cdot 10^{-7}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t1 < -9.19999999999999938e124 or 2.9999999999999999e-7 < t1 Initial program 57.3%
*-commutative57.3%
times-frac100.0%
neg-mul-1100.0%
associate-/l*100.0%
associate-*r/100.0%
associate-/l*100.0%
associate-/l/100.0%
neg-mul-1100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate--r+100.0%
neg-sub0100.0%
div-sub100.0%
distribute-frac-neg100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t1 around inf 93.6%
Taylor expanded in v around 0 93.6%
associate-*r/93.6%
neg-mul-193.6%
Simplified93.6%
Taylor expanded in t1 around 0 93.6%
+-commutative93.6%
Simplified93.6%
if -9.19999999999999938e124 < t1 < -7.1999999999999999e84 or -3.6500000000000002e-109 < t1 < 2.9999999999999999e-7Initial program 82.9%
times-frac98.3%
Simplified98.3%
Taylor expanded in t1 around 0 83.5%
Taylor expanded in t1 around 0 87.0%
mul-1-neg87.0%
Simplified87.0%
if -7.1999999999999999e84 < t1 < -3.6500000000000002e-109Initial program 94.8%
*-commutative94.8%
times-frac99.8%
neg-mul-199.8%
associate-/l*99.8%
associate-*r/99.9%
associate-/l*99.9%
associate-/l/99.9%
neg-mul-199.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub0-neg99.9%
associate--r+99.9%
neg-sub099.9%
div-sub99.9%
distribute-frac-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t1 around inf 71.6%
Final simplification87.1%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- -1.0 (/ u t1))) (t_2 (/ (- v) (+ t1 u))))
(if (<= t1 -9.2e+124)
t_2
(if (<= t1 -7.2e+84)
(/ (/ v u) t_1)
(if (<= t1 -3.4e-107)
(/ (/ v t1) t_1)
(if (<= t1 6.1e-5) (* (/ t1 u) (/ (- v) u)) t_2))))))
double code(double u, double v, double t1) {
double t_1 = -1.0 - (u / t1);
double t_2 = -v / (t1 + u);
double tmp;
if (t1 <= -9.2e+124) {
tmp = t_2;
} else if (t1 <= -7.2e+84) {
tmp = (v / u) / t_1;
} else if (t1 <= -3.4e-107) {
tmp = (v / t1) / t_1;
} else if (t1 <= 6.1e-5) {
tmp = (t1 / u) * (-v / u);
} 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 = (-1.0d0) - (u / t1)
t_2 = -v / (t1 + u)
if (t1 <= (-9.2d+124)) then
tmp = t_2
else if (t1 <= (-7.2d+84)) then
tmp = (v / u) / t_1
else if (t1 <= (-3.4d-107)) then
tmp = (v / t1) / t_1
else if (t1 <= 6.1d-5) then
tmp = (t1 / u) * (-v / u)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -1.0 - (u / t1);
double t_2 = -v / (t1 + u);
double tmp;
if (t1 <= -9.2e+124) {
tmp = t_2;
} else if (t1 <= -7.2e+84) {
tmp = (v / u) / t_1;
} else if (t1 <= -3.4e-107) {
tmp = (v / t1) / t_1;
} else if (t1 <= 6.1e-5) {
tmp = (t1 / u) * (-v / u);
} else {
tmp = t_2;
}
return tmp;
}
def code(u, v, t1): t_1 = -1.0 - (u / t1) t_2 = -v / (t1 + u) tmp = 0 if t1 <= -9.2e+124: tmp = t_2 elif t1 <= -7.2e+84: tmp = (v / u) / t_1 elif t1 <= -3.4e-107: tmp = (v / t1) / t_1 elif t1 <= 6.1e-5: tmp = (t1 / u) * (-v / u) else: tmp = t_2 return tmp
function code(u, v, t1) t_1 = Float64(-1.0 - Float64(u / t1)) t_2 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -9.2e+124) tmp = t_2; elseif (t1 <= -7.2e+84) tmp = Float64(Float64(v / u) / t_1); elseif (t1 <= -3.4e-107) tmp = Float64(Float64(v / t1) / t_1); elseif (t1 <= 6.1e-5) tmp = Float64(Float64(t1 / u) * Float64(Float64(-v) / u)); else tmp = t_2; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -1.0 - (u / t1); t_2 = -v / (t1 + u); tmp = 0.0; if (t1 <= -9.2e+124) tmp = t_2; elseif (t1 <= -7.2e+84) tmp = (v / u) / t_1; elseif (t1 <= -3.4e-107) tmp = (v / t1) / t_1; elseif (t1 <= 6.1e-5) tmp = (t1 / u) * (-v / u); else tmp = t_2; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -9.2e+124], t$95$2, If[LessEqual[t1, -7.2e+84], N[(N[(v / u), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t1, -3.4e-107], N[(N[(v / t1), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t1, 6.1e-5], N[(N[(t1 / u), $MachinePrecision] * N[((-v) / u), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -1 - \frac{u}{t1}\\
t_2 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -9.2 \cdot 10^{+124}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t1 \leq -7.2 \cdot 10^{+84}:\\
\;\;\;\;\frac{\frac{v}{u}}{t_1}\\
\mathbf{elif}\;t1 \leq -3.4 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{v}{t1}}{t_1}\\
\mathbf{elif}\;t1 \leq 6.1 \cdot 10^{-5}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{-v}{u}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t1 < -9.19999999999999938e124 or 6.09999999999999987e-5 < t1 Initial program 57.3%
*-commutative57.3%
times-frac100.0%
neg-mul-1100.0%
associate-/l*100.0%
associate-*r/100.0%
associate-/l*100.0%
associate-/l/100.0%
neg-mul-1100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate--r+100.0%
neg-sub0100.0%
div-sub100.0%
distribute-frac-neg100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t1 around inf 93.6%
Taylor expanded in v around 0 93.6%
associate-*r/93.6%
neg-mul-193.6%
Simplified93.6%
Taylor expanded in t1 around 0 93.6%
+-commutative93.6%
Simplified93.6%
if -9.19999999999999938e124 < t1 < -7.1999999999999999e84Initial program 40.8%
*-commutative40.8%
times-frac100.0%
neg-mul-1100.0%
associate-/l*99.4%
associate-*r/100.0%
associate-/l*100.0%
associate-/l/100.0%
neg-mul-1100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate--r+100.0%
neg-sub0100.0%
div-sub100.0%
distribute-frac-neg100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t1 around 0 95.9%
if -7.1999999999999999e84 < t1 < -3.39999999999999994e-107Initial program 94.8%
*-commutative94.8%
times-frac99.8%
neg-mul-199.8%
associate-/l*99.8%
associate-*r/99.9%
associate-/l*99.9%
associate-/l/99.9%
neg-mul-199.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub0-neg99.9%
associate--r+99.9%
neg-sub099.9%
div-sub99.9%
distribute-frac-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t1 around inf 71.6%
if -3.39999999999999994e-107 < t1 < 6.09999999999999987e-5Initial program 84.8%
times-frac98.2%
Simplified98.2%
Taylor expanded in t1 around 0 82.9%
Taylor expanded in t1 around 0 86.7%
mul-1-neg86.7%
Simplified86.7%
Final simplification87.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.22e-33) (not (<= t1 5.4e-8))) (/ (- v) (+ t1 u)) (* t1 (/ (- v) (* u u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.22e-33) || !(t1 <= 5.4e-8)) {
tmp = -v / (t1 + u);
} 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 <= (-1.22d-33)) .or. (.not. (t1 <= 5.4d-8))) then
tmp = -v / (t1 + u)
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 <= -1.22e-33) || !(t1 <= 5.4e-8)) {
tmp = -v / (t1 + u);
} else {
tmp = t1 * (-v / (u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.22e-33) or not (t1 <= 5.4e-8): tmp = -v / (t1 + u) else: tmp = t1 * (-v / (u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.22e-33) || !(t1 <= 5.4e-8)) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = Float64(t1 * Float64(Float64(-v) / Float64(u * u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.22e-33) || ~((t1 <= 5.4e-8))) tmp = -v / (t1 + u); else tmp = t1 * (-v / (u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.22e-33], N[Not[LessEqual[t1, 5.4e-8]], $MachinePrecision]], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[(t1 * N[((-v) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.22 \cdot 10^{-33} \lor \neg \left(t1 \leq 5.4 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;t1 \cdot \frac{-v}{u \cdot u}\\
\end{array}
\end{array}
if t1 < -1.22e-33 or 5.40000000000000005e-8 < t1 Initial program 64.3%
*-commutative64.3%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/100.0%
associate-/l*100.0%
associate-/l/100.0%
neg-mul-1100.0%
*-lft-identity100.0%
metadata-eval100.0%
times-frac100.0%
neg-mul-1100.0%
remove-double-neg100.0%
neg-mul-1100.0%
sub0-neg100.0%
associate--r+100.0%
neg-sub0100.0%
div-sub100.0%
distribute-frac-neg100.0%
*-inverses100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in t1 around inf 84.8%
Taylor expanded in v around 0 84.8%
associate-*r/84.8%
neg-mul-184.8%
Simplified84.8%
Taylor expanded in t1 around 0 84.8%
+-commutative84.8%
Simplified84.8%
if -1.22e-33 < t1 < 5.40000000000000005e-8Initial program 86.2%
associate-/l*87.8%
Simplified87.8%
Taylor expanded in t1 around 0 79.4%
unpow279.4%
Simplified79.4%
distribute-frac-neg79.4%
div-inv79.4%
clear-num79.4%
Applied egg-rr79.4%
Final simplification82.1%
(FPCore (u v t1) :precision binary64 (if (or (<= u -6.2e+32) (not (<= u 1.8e+91))) (* t1 (/ v (* u u))) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -6.2e+32) || !(u <= 1.8e+91)) {
tmp = t1 * (v / (u * u));
} else {
tmp = -v / t1;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((u <= (-6.2d+32)) .or. (.not. (u <= 1.8d+91))) then
tmp = t1 * (v / (u * u))
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -6.2e+32) || !(u <= 1.8e+91)) {
tmp = t1 * (v / (u * u));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -6.2e+32) or not (u <= 1.8e+91): tmp = t1 * (v / (u * u)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -6.2e+32) || !(u <= 1.8e+91)) tmp = Float64(t1 * Float64(v / Float64(u * u))); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -6.2e+32) || ~((u <= 1.8e+91))) tmp = t1 * (v / (u * u)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -6.2e+32], N[Not[LessEqual[u, 1.8e+91]], $MachinePrecision]], N[(t1 * N[(v / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -6.2 \cdot 10^{+32} \lor \neg \left(u \leq 1.8 \cdot 10^{+91}\right):\\
\;\;\;\;t1 \cdot \frac{v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -6.19999999999999986e32 or 1.8e91 < u Initial program 81.9%
associate-/l*80.3%
Simplified80.3%
Taylor expanded in t1 around 0 78.3%
unpow278.3%
Simplified78.3%
div-inv78.2%
add-sqr-sqrt47.2%
sqrt-unprod68.2%
sqr-neg68.2%
sqrt-unprod28.9%
add-sqr-sqrt68.1%
clear-num68.1%
Applied egg-rr68.1%
if -6.19999999999999986e32 < u < 1.8e91Initial program 71.5%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around inf 69.5%
associate-*r/69.5%
neg-mul-169.5%
Simplified69.5%
Final simplification69.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3.7e+129) (not (<= u 6.5e+138))) (/ (- v) u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.7e+129) || !(u <= 6.5e+138)) {
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.7d+129)) .or. (.not. (u <= 6.5d+138))) 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.7e+129) || !(u <= 6.5e+138)) {
tmp = -v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3.7e+129) or not (u <= 6.5e+138): tmp = -v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3.7e+129) || !(u <= 6.5e+138)) tmp = Float64(Float64(-v) / u); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3.7e+129) || ~((u <= 6.5e+138))) tmp = -v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3.7e+129], N[Not[LessEqual[u, 6.5e+138]], $MachinePrecision]], N[((-v) / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.7 \cdot 10^{+129} \lor \neg \left(u \leq 6.5 \cdot 10^{+138}\right):\\
\;\;\;\;\frac{-v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -3.69999999999999978e129 or 6.50000000000000054e138 < u Initial program 81.0%
*-commutative81.0%
times-frac98.6%
neg-mul-198.6%
associate-/l*98.5%
associate-*r/98.6%
associate-/l*98.6%
associate-/l/98.6%
neg-mul-198.6%
*-lft-identity98.6%
metadata-eval98.6%
times-frac98.6%
neg-mul-198.6%
remove-double-neg98.6%
neg-mul-198.6%
sub0-neg98.6%
associate--r+98.6%
neg-sub098.6%
div-sub98.6%
distribute-frac-neg98.6%
*-inverses98.6%
metadata-eval98.6%
Simplified98.6%
Taylor expanded in t1 around inf 60.9%
Taylor expanded in t1 around 0 42.9%
associate-*r/42.9%
neg-mul-142.9%
Simplified42.9%
if -3.69999999999999978e129 < u < 6.50000000000000054e138Initial program 73.1%
times-frac99.4%
Simplified99.4%
Taylor expanded in t1 around inf 64.4%
associate-*r/64.4%
neg-mul-164.4%
Simplified64.4%
Final simplification59.1%
(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 75.1%
*-commutative75.1%
times-frac99.2%
neg-mul-199.2%
associate-/l*99.2%
associate-*r/99.2%
associate-/l*99.2%
associate-/l/99.2%
neg-mul-199.2%
*-lft-identity99.2%
metadata-eval99.2%
times-frac99.2%
neg-mul-199.2%
remove-double-neg99.2%
neg-mul-199.2%
sub0-neg99.2%
associate--r+99.2%
neg-sub099.2%
div-sub99.2%
distribute-frac-neg99.2%
*-inverses99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in t1 around inf 63.2%
Taylor expanded in v around 0 65.3%
associate-*r/65.3%
neg-mul-165.3%
Simplified65.3%
Taylor expanded in t1 around 0 59.6%
+-commutative59.6%
Simplified59.6%
Final simplification59.6%
(FPCore (u v t1) :precision binary64 (/ (- v) t1))
double code(double u, double v, double t1) {
return -v / t1;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / t1
end function
public static double code(double u, double v, double t1) {
return -v / t1;
}
def code(u, v, t1): return -v / t1
function code(u, v, t1) return Float64(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 75.1%
times-frac99.2%
Simplified99.2%
Taylor expanded in t1 around inf 52.6%
associate-*r/52.6%
neg-mul-152.6%
Simplified52.6%
Final simplification52.6%
herbie shell --seed 2023178
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))