
(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 10 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(t1 / Float64(t1 + u)) * Float64(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 71.1%
associate-/r*80.5%
associate-/l*96.3%
Simplified96.3%
Taylor expanded in v around 0 80.5%
mul-1-neg80.5%
associate-*l/97.5%
distribute-rgt-neg-out97.5%
Simplified97.5%
frac-2neg97.5%
distribute-frac-neg97.5%
add-sqr-sqrt45.1%
sqrt-unprod49.9%
sqr-neg49.9%
sqrt-unprod20.0%
add-sqr-sqrt36.2%
distribute-rgt-neg-in36.2%
frac-2neg36.2%
div-inv36.2%
associate-*l*36.2%
add-sqr-sqrt20.0%
sqrt-unprod49.8%
sqr-neg49.8%
sqrt-unprod46.5%
add-sqr-sqrt98.7%
div-inv98.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* v (/ (/ t1 u) u))))
(if (<= u -6e+74)
t_1
(if (<= u 2.05e+15)
(- (/ v t1))
(if (or (<= u 6.5e+39) (not (<= u 1.2e+142)))
t_1
(/ (- v) (+ t1 u)))))))
double code(double u, double v, double t1) {
double t_1 = v * ((t1 / u) / u);
double tmp;
if (u <= -6e+74) {
tmp = t_1;
} else if (u <= 2.05e+15) {
tmp = -(v / t1);
} else if ((u <= 6.5e+39) || !(u <= 1.2e+142)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = v * ((t1 / u) / u)
if (u <= (-6d+74)) then
tmp = t_1
else if (u <= 2.05d+15) then
tmp = -(v / t1)
else if ((u <= 6.5d+39) .or. (.not. (u <= 1.2d+142))) then
tmp = t_1
else
tmp = -v / (t1 + u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = v * ((t1 / u) / u);
double tmp;
if (u <= -6e+74) {
tmp = t_1;
} else if (u <= 2.05e+15) {
tmp = -(v / t1);
} else if ((u <= 6.5e+39) || !(u <= 1.2e+142)) {
tmp = t_1;
} else {
tmp = -v / (t1 + u);
}
return tmp;
}
def code(u, v, t1): t_1 = v * ((t1 / u) / u) tmp = 0 if u <= -6e+74: tmp = t_1 elif u <= 2.05e+15: tmp = -(v / t1) elif (u <= 6.5e+39) or not (u <= 1.2e+142): tmp = t_1 else: tmp = -v / (t1 + u) return tmp
function code(u, v, t1) t_1 = Float64(v * Float64(Float64(t1 / u) / u)) tmp = 0.0 if (u <= -6e+74) tmp = t_1; elseif (u <= 2.05e+15) tmp = Float64(-Float64(v / t1)); elseif ((u <= 6.5e+39) || !(u <= 1.2e+142)) tmp = t_1; else tmp = Float64(Float64(-v) / Float64(t1 + u)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v * ((t1 / u) / u); tmp = 0.0; if (u <= -6e+74) tmp = t_1; elseif (u <= 2.05e+15) tmp = -(v / t1); elseif ((u <= 6.5e+39) || ~((u <= 1.2e+142))) tmp = t_1; else tmp = -v / (t1 + u); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -6e+74], t$95$1, If[LessEqual[u, 2.05e+15], (-N[(v / t1), $MachinePrecision]), If[Or[LessEqual[u, 6.5e+39], N[Not[LessEqual[u, 1.2e+142]], $MachinePrecision]], t$95$1, N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := v \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{if}\;u \leq -6 \cdot 10^{+74}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;u \leq 2.05 \cdot 10^{+15}:\\
\;\;\;\;-\frac{v}{t1}\\
\mathbf{elif}\;u \leq 6.5 \cdot 10^{+39} \lor \neg \left(u \leq 1.2 \cdot 10^{+142}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\end{array}
\end{array}
if u < -6e74 or 2.05e15 < u < 6.5000000000000001e39 or 1.2e142 < u Initial program 77.5%
associate-*l/75.2%
*-commutative75.2%
Simplified75.2%
Taylor expanded in t1 around 0 74.1%
associate-*r/74.1%
neg-mul-174.1%
unpow274.1%
Simplified74.1%
associate-/r*79.5%
div-inv79.4%
add-sqr-sqrt33.8%
sqrt-unprod62.6%
sqr-neg62.6%
sqrt-unprod38.5%
add-sqr-sqrt67.1%
Applied egg-rr67.1%
associate-*r/67.1%
*-rgt-identity67.1%
Simplified67.1%
if -6e74 < u < 2.05e15Initial program 65.0%
associate-*l/73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in t1 around inf 69.6%
associate-*r/69.6%
neg-mul-169.6%
Simplified69.6%
if 6.5000000000000001e39 < u < 1.2e142Initial program 82.0%
associate-/r*89.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t1 around inf 54.7%
neg-mul-154.7%
Simplified54.7%
Final simplification67.2%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (/ u (/ t1 u)))))
(if (<= u -5.3e+73)
t_1
(if (<= u 2.4e+15)
(- (/ v t1))
(if (<= u 6.5e+39)
(* v (/ (/ t1 u) u))
(if (<= u 2.6e+144) (/ (- v) (+ t1 u)) t_1))))))
double code(double u, double v, double t1) {
double t_1 = v / (u / (t1 / u));
double tmp;
if (u <= -5.3e+73) {
tmp = t_1;
} else if (u <= 2.4e+15) {
tmp = -(v / t1);
} else if (u <= 6.5e+39) {
tmp = v * ((t1 / u) / u);
} else if (u <= 2.6e+144) {
tmp = -v / (t1 + u);
} 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) :: tmp
t_1 = v / (u / (t1 / u))
if (u <= (-5.3d+73)) then
tmp = t_1
else if (u <= 2.4d+15) then
tmp = -(v / t1)
else if (u <= 6.5d+39) then
tmp = v * ((t1 / u) / u)
else if (u <= 2.6d+144) then
tmp = -v / (t1 + u)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = v / (u / (t1 / u));
double tmp;
if (u <= -5.3e+73) {
tmp = t_1;
} else if (u <= 2.4e+15) {
tmp = -(v / t1);
} else if (u <= 6.5e+39) {
tmp = v * ((t1 / u) / u);
} else if (u <= 2.6e+144) {
tmp = -v / (t1 + u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = v / (u / (t1 / u)) tmp = 0 if u <= -5.3e+73: tmp = t_1 elif u <= 2.4e+15: tmp = -(v / t1) elif u <= 6.5e+39: tmp = v * ((t1 / u) / u) elif u <= 2.6e+144: tmp = -v / (t1 + u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(v / Float64(u / Float64(t1 / u))) tmp = 0.0 if (u <= -5.3e+73) tmp = t_1; elseif (u <= 2.4e+15) tmp = Float64(-Float64(v / t1)); elseif (u <= 6.5e+39) tmp = Float64(v * Float64(Float64(t1 / u) / u)); elseif (u <= 2.6e+144) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v / (u / (t1 / u)); tmp = 0.0; if (u <= -5.3e+73) tmp = t_1; elseif (u <= 2.4e+15) tmp = -(v / t1); elseif (u <= 6.5e+39) tmp = v * ((t1 / u) / u); elseif (u <= 2.6e+144) tmp = -v / (t1 + u); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(u / N[(t1 / u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -5.3e+73], t$95$1, If[LessEqual[u, 2.4e+15], (-N[(v / t1), $MachinePrecision]), If[LessEqual[u, 6.5e+39], N[(v * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 2.6e+144], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{\frac{u}{\frac{t1}{u}}}\\
\mathbf{if}\;u \leq -5.3 \cdot 10^{+73}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;u \leq 2.4 \cdot 10^{+15}:\\
\;\;\;\;-\frac{v}{t1}\\
\mathbf{elif}\;u \leq 6.5 \cdot 10^{+39}:\\
\;\;\;\;v \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{elif}\;u \leq 2.6 \cdot 10^{+144}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if u < -5.29999999999999996e73 or 2.5999999999999999e144 < u Initial program 75.0%
associate-*l/73.6%
*-commutative73.6%
Simplified73.6%
Taylor expanded in t1 around 0 72.4%
associate-*r/72.4%
neg-mul-172.4%
unpow272.4%
Simplified72.4%
clear-num72.4%
un-div-inv72.4%
add-sqr-sqrt30.6%
sqrt-unprod59.4%
sqr-neg59.4%
sqrt-unprod39.4%
add-sqr-sqrt68.8%
Applied egg-rr68.8%
associate-/l*68.3%
add-cbrt-cube68.9%
cbrt-prod68.8%
*-un-lft-identity68.8%
times-frac68.8%
cbrt-prod68.3%
pow268.3%
Applied egg-rr68.3%
/-rgt-identity68.3%
associate-*r/68.3%
unpow268.3%
rem-3cbrt-lft68.3%
Simplified68.3%
if -5.29999999999999996e73 < u < 2.4e15Initial program 65.0%
associate-*l/73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in t1 around inf 69.6%
associate-*r/69.6%
neg-mul-169.6%
Simplified69.6%
if 2.4e15 < u < 6.5000000000000001e39Initial program 99.7%
associate-*l/89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in t1 around 0 89.0%
associate-*r/89.0%
neg-mul-189.0%
unpow289.0%
Simplified89.0%
associate-/r*89.0%
div-inv89.0%
add-sqr-sqrt33.2%
sqrt-unprod67.5%
sqr-neg67.5%
sqrt-unprod34.2%
add-sqr-sqrt56.7%
Applied egg-rr56.7%
associate-*r/56.7%
*-rgt-identity56.7%
Simplified56.7%
if 6.5000000000000001e39 < u < 2.5999999999999999e144Initial program 82.0%
associate-/r*89.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t1 around inf 54.7%
neg-mul-154.7%
Simplified54.7%
Final simplification67.2%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (/ (* u u) t1))))
(if (<= u -5.6e+74)
t_1
(if (<= u 1.8e+15)
(- (/ v t1))
(if (<= u 6.5e+39)
(* v (/ (/ t1 u) u))
(if (<= u 9.5e+144) (/ (- v) (+ t1 u)) t_1))))))
double code(double u, double v, double t1) {
double t_1 = v / ((u * u) / t1);
double tmp;
if (u <= -5.6e+74) {
tmp = t_1;
} else if (u <= 1.8e+15) {
tmp = -(v / t1);
} else if (u <= 6.5e+39) {
tmp = v * ((t1 / u) / u);
} else if (u <= 9.5e+144) {
tmp = -v / (t1 + u);
} 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) :: tmp
t_1 = v / ((u * u) / t1)
if (u <= (-5.6d+74)) then
tmp = t_1
else if (u <= 1.8d+15) then
tmp = -(v / t1)
else if (u <= 6.5d+39) then
tmp = v * ((t1 / u) / u)
else if (u <= 9.5d+144) then
tmp = -v / (t1 + u)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = v / ((u * u) / t1);
double tmp;
if (u <= -5.6e+74) {
tmp = t_1;
} else if (u <= 1.8e+15) {
tmp = -(v / t1);
} else if (u <= 6.5e+39) {
tmp = v * ((t1 / u) / u);
} else if (u <= 9.5e+144) {
tmp = -v / (t1 + u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = v / ((u * u) / t1) tmp = 0 if u <= -5.6e+74: tmp = t_1 elif u <= 1.8e+15: tmp = -(v / t1) elif u <= 6.5e+39: tmp = v * ((t1 / u) / u) elif u <= 9.5e+144: tmp = -v / (t1 + u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(v / Float64(Float64(u * u) / t1)) tmp = 0.0 if (u <= -5.6e+74) tmp = t_1; elseif (u <= 1.8e+15) tmp = Float64(-Float64(v / t1)); elseif (u <= 6.5e+39) tmp = Float64(v * Float64(Float64(t1 / u) / u)); elseif (u <= 9.5e+144) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v / ((u * u) / t1); tmp = 0.0; if (u <= -5.6e+74) tmp = t_1; elseif (u <= 1.8e+15) tmp = -(v / t1); elseif (u <= 6.5e+39) tmp = v * ((t1 / u) / u); elseif (u <= 9.5e+144) tmp = -v / (t1 + u); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(N[(u * u), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[u, -5.6e+74], t$95$1, If[LessEqual[u, 1.8e+15], (-N[(v / t1), $MachinePrecision]), If[LessEqual[u, 6.5e+39], N[(v * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 9.5e+144], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{\frac{u \cdot u}{t1}}\\
\mathbf{if}\;u \leq -5.6 \cdot 10^{+74}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;u \leq 1.8 \cdot 10^{+15}:\\
\;\;\;\;-\frac{v}{t1}\\
\mathbf{elif}\;u \leq 6.5 \cdot 10^{+39}:\\
\;\;\;\;v \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{elif}\;u \leq 9.5 \cdot 10^{+144}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if u < -5.60000000000000003e74 or 9.50000000000000031e144 < u Initial program 75.0%
associate-*l/73.6%
*-commutative73.6%
Simplified73.6%
Taylor expanded in t1 around 0 72.4%
associate-*r/72.4%
neg-mul-172.4%
unpow272.4%
Simplified72.4%
clear-num72.4%
un-div-inv72.4%
add-sqr-sqrt30.6%
sqrt-unprod59.4%
sqr-neg59.4%
sqrt-unprod39.4%
add-sqr-sqrt68.8%
Applied egg-rr68.8%
if -5.60000000000000003e74 < u < 1.8e15Initial program 65.0%
associate-*l/73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in t1 around inf 69.6%
associate-*r/69.6%
neg-mul-169.6%
Simplified69.6%
if 1.8e15 < u < 6.5000000000000001e39Initial program 99.7%
associate-*l/89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in t1 around 0 89.0%
associate-*r/89.0%
neg-mul-189.0%
unpow289.0%
Simplified89.0%
associate-/r*89.0%
div-inv89.0%
add-sqr-sqrt33.2%
sqrt-unprod67.5%
sqr-neg67.5%
sqrt-unprod34.2%
add-sqr-sqrt56.7%
Applied egg-rr56.7%
associate-*r/56.7%
*-rgt-identity56.7%
Simplified56.7%
if 6.5000000000000001e39 < u < 9.50000000000000031e144Initial program 82.0%
associate-/r*89.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t1 around inf 54.7%
neg-mul-154.7%
Simplified54.7%
Final simplification67.3%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -2.8e-12)
(/ (- v) (+ t1 u))
(if (<= t1 1.45e+79)
(* (- (/ t1 u)) (/ v u))
(* (/ v (+ t1 u)) (+ (/ u t1) -1.0)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.8e-12) {
tmp = -v / (t1 + u);
} else if (t1 <= 1.45e+79) {
tmp = -(t1 / u) * (v / u);
} else {
tmp = (v / (t1 + u)) * ((u / t1) + -1.0);
}
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.8d-12)) then
tmp = -v / (t1 + u)
else if (t1 <= 1.45d+79) then
tmp = -(t1 / u) * (v / u)
else
tmp = (v / (t1 + u)) * ((u / t1) + (-1.0d0))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -2.8e-12) {
tmp = -v / (t1 + u);
} else if (t1 <= 1.45e+79) {
tmp = -(t1 / u) * (v / u);
} else {
tmp = (v / (t1 + u)) * ((u / t1) + -1.0);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -2.8e-12: tmp = -v / (t1 + u) elif t1 <= 1.45e+79: tmp = -(t1 / u) * (v / u) else: tmp = (v / (t1 + u)) * ((u / t1) + -1.0) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -2.8e-12) tmp = Float64(Float64(-v) / Float64(t1 + u)); elseif (t1 <= 1.45e+79) tmp = Float64(Float64(-Float64(t1 / u)) * Float64(v / u)); else tmp = Float64(Float64(v / Float64(t1 + u)) * Float64(Float64(u / t1) + -1.0)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -2.8e-12) tmp = -v / (t1 + u); elseif (t1 <= 1.45e+79) tmp = -(t1 / u) * (v / u); else tmp = (v / (t1 + u)) * ((u / t1) + -1.0); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -2.8e-12], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.45e+79], N[((-N[(t1 / u), $MachinePrecision]) * N[(v / u), $MachinePrecision]), $MachinePrecision], N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[(N[(u / t1), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.8 \cdot 10^{-12}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{elif}\;t1 \leq 1.45 \cdot 10^{+79}:\\
\;\;\;\;\left(-\frac{t1}{u}\right) \cdot \frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{t1 + u} \cdot \left(\frac{u}{t1} + -1\right)\\
\end{array}
\end{array}
if t1 < -2.8000000000000002e-12Initial program 60.8%
associate-/r*72.4%
associate-/l*97.5%
Simplified97.5%
Taylor expanded in t1 around inf 83.7%
neg-mul-183.7%
Simplified83.7%
if -2.8000000000000002e-12 < t1 < 1.44999999999999996e79Initial program 84.3%
associate-/r*89.1%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in v around 0 89.1%
mul-1-neg89.1%
associate-*l/95.6%
distribute-rgt-neg-out95.6%
Simplified95.6%
Taylor expanded in t1 around 0 70.0%
associate-*r/70.0%
associate-*r*70.0%
unpow270.0%
times-frac78.4%
mul-1-neg78.4%
Simplified78.4%
if 1.44999999999999996e79 < t1 Initial program 45.8%
associate-/r*65.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t1 around inf 79.6%
neg-mul-179.6%
+-commutative79.6%
unsub-neg79.6%
*-commutative79.6%
associate-/l*85.3%
Simplified85.3%
Taylor expanded in v around 0 85.3%
*-rgt-identity85.3%
associate-*r/85.1%
*-commutative85.1%
associate-*l*86.8%
sub-neg86.8%
metadata-eval86.8%
associate-*r/87.0%
*-rgt-identity87.0%
Simplified87.0%
Final simplification81.3%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.9e-96) (not (<= t1 1e-14))) (/ (- v) (+ t1 u)) (/ (- v) (* u (/ u t1)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.9e-96) || !(t1 <= 1e-14)) {
tmp = -v / (t1 + u);
} else {
tmp = -v / (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 <= (-2.9d-96)) .or. (.not. (t1 <= 1d-14))) then
tmp = -v / (t1 + u)
else
tmp = -v / (u * (u / t1))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.9e-96) || !(t1 <= 1e-14)) {
tmp = -v / (t1 + u);
} else {
tmp = -v / (u * (u / t1));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.9e-96) or not (t1 <= 1e-14): tmp = -v / (t1 + u) else: tmp = -v / (u * (u / t1)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.9e-96) || !(t1 <= 1e-14)) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = Float64(Float64(-v) / Float64(u * Float64(u / t1))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.9e-96) || ~((t1 <= 1e-14))) tmp = -v / (t1 + u); else tmp = -v / (u * (u / t1)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.9e-96], N[Not[LessEqual[t1, 1e-14]], $MachinePrecision]], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[((-v) / N[(u * N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.9 \cdot 10^{-96} \lor \neg \left(t1 \leq 10^{-14}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u \cdot \frac{u}{t1}}\\
\end{array}
\end{array}
if t1 < -2.89999999999999994e-96 or 9.99999999999999999e-15 < t1 Initial program 62.2%
associate-/r*74.6%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in t1 around inf 78.9%
neg-mul-178.9%
Simplified78.9%
if -2.89999999999999994e-96 < t1 < 9.99999999999999999e-15Initial program 81.5%
associate-/r*87.4%
associate-/l*93.4%
Simplified93.4%
Taylor expanded in v around 0 87.4%
mul-1-neg87.4%
associate-*l/94.6%
distribute-rgt-neg-out94.6%
Simplified94.6%
frac-2neg94.6%
distribute-frac-neg94.6%
add-sqr-sqrt40.6%
sqrt-unprod46.7%
sqr-neg46.7%
sqrt-unprod21.7%
add-sqr-sqrt40.2%
distribute-rgt-neg-in40.2%
frac-2neg40.2%
div-inv40.2%
associate-*l*40.1%
add-sqr-sqrt21.7%
sqrt-unprod46.7%
sqr-neg46.7%
sqrt-unprod43.7%
add-sqr-sqrt97.6%
div-inv97.7%
Applied egg-rr97.7%
div-inv97.6%
add-cube-cbrt96.9%
associate-*l*96.9%
pow296.9%
Applied egg-rr96.9%
Taylor expanded in t1 around 0 73.7%
*-commutative73.7%
associate-*r/74.4%
unpow274.4%
*-lft-identity74.4%
unpow274.4%
associate-*l/73.9%
associate-/r/74.3%
unpow274.3%
associate-*l/82.0%
associate-*r/82.0%
*-commutative82.0%
*-rgt-identity82.0%
Simplified82.0%
Final simplification80.4%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -3.9e-13) (not (<= t1 1.25e-14))) (/ (- v) (+ t1 u)) (* (- (/ t1 u)) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.9e-13) || !(t1 <= 1.25e-14)) {
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 <= (-3.9d-13)) .or. (.not. (t1 <= 1.25d-14))) 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 <= -3.9e-13) || !(t1 <= 1.25e-14)) {
tmp = -v / (t1 + u);
} else {
tmp = -(t1 / u) * (v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -3.9e-13) or not (t1 <= 1.25e-14): tmp = -v / (t1 + u) else: tmp = -(t1 / u) * (v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -3.9e-13) || !(t1 <= 1.25e-14)) 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 <= -3.9e-13) || ~((t1 <= 1.25e-14))) tmp = -v / (t1 + u); else tmp = -(t1 / u) * (v / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -3.9e-13], N[Not[LessEqual[t1, 1.25e-14]], $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 -3.9 \cdot 10^{-13} \lor \neg \left(t1 \leq 1.25 \cdot 10^{-14}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\left(-\frac{t1}{u}\right) \cdot \frac{v}{u}\\
\end{array}
\end{array}
if t1 < -3.90000000000000004e-13 or 1.25e-14 < t1 Initial program 58.3%
associate-/r*72.0%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in t1 around inf 81.4%
neg-mul-181.4%
Simplified81.4%
if -3.90000000000000004e-13 < t1 < 1.25e-14Initial program 83.3%
associate-/r*88.6%
associate-/l*94.0%
Simplified94.0%
Taylor expanded in v around 0 88.6%
mul-1-neg88.6%
associate-*l/95.2%
distribute-rgt-neg-out95.2%
Simplified95.2%
Taylor expanded in t1 around 0 71.9%
associate-*r/71.9%
associate-*r*71.9%
unpow271.9%
times-frac81.2%
mul-1-neg81.2%
Simplified81.2%
Final simplification81.3%
(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 71.1%
associate-/r*80.5%
associate-/l*96.3%
Simplified96.3%
Taylor expanded in t1 around inf 56.3%
neg-mul-156.3%
Simplified56.3%
Final simplification56.3%
(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 71.1%
associate-*l/74.2%
*-commutative74.2%
Simplified74.2%
Taylor expanded in t1 around inf 50.5%
associate-*r/50.5%
neg-mul-150.5%
Simplified50.5%
Final simplification50.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 71.1%
associate-*l/74.2%
*-commutative74.2%
Simplified74.2%
associate-/r*95.7%
associate-*r/97.5%
*-commutative97.5%
associate-/r/96.3%
div-inv96.2%
frac-2neg96.2%
frac-times82.4%
remove-double-neg82.4%
*-commutative82.4%
*-un-lft-identity82.4%
distribute-neg-frac82.4%
distribute-neg-in82.4%
add-sqr-sqrt39.8%
sqrt-unprod67.7%
sqr-neg67.7%
sqrt-unprod31.8%
add-sqr-sqrt59.2%
sub-neg59.2%
Applied egg-rr59.2%
Taylor expanded in t1 around inf 14.0%
Final simplification14.0%
herbie shell --seed 2023264
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))