
(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 (/ (* (/ v (+ t1 u)) (- t1)) (+ t1 u)))
double code(double u, double v, double t1) {
return ((v / (t1 + u)) * -t1) / (t1 + u);
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = ((v / (t1 + u)) * -t1) / (t1 + u)
end function
public static double code(double u, double v, double t1) {
return ((v / (t1 + u)) * -t1) / (t1 + u);
}
def code(u, v, t1): return ((v / (t1 + u)) * -t1) / (t1 + u)
function code(u, v, t1) return Float64(Float64(Float64(v / Float64(t1 + u)) * Float64(-t1)) / Float64(t1 + u)) end
function tmp = code(u, v, t1) tmp = ((v / (t1 + u)) * -t1) / (t1 + u); end
code[u_, v_, t1_] := N[(N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * (-t1)), $MachinePrecision] / N[(t1 + u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{t1 + u} \cdot \left(-t1\right)}{t1 + u}
\end{array}
Initial program 66.6%
associate-/r*79.1%
associate-/l*97.0%
Simplified97.0%
div-inv96.8%
clear-num97.0%
add-sqr-sqrt45.5%
sqrt-unprod39.5%
sqr-neg39.5%
sqrt-unprod17.3%
add-sqr-sqrt34.7%
distribute-lft-neg-in34.7%
distribute-rgt-neg-in34.7%
add-sqr-sqrt17.3%
sqrt-unprod39.5%
sqr-neg39.5%
sqrt-unprod45.5%
add-sqr-sqrt97.0%
Applied egg-rr97.0%
Final simplification97.0%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (* v (/ (- t1) (* (+ t1 u) (+ t1 u))))))
(if (<= t1 -3.4e+123)
(/ (- v) (+ t1 u))
(if (<= t1 -4.5e-148)
t_1
(if (<= t1 1.15e-202)
(* v (* (/ -1.0 u) (/ t1 u)))
(if (<= t1 1.05e+119) t_1 (/ v (- u t1))))))))
double code(double u, double v, double t1) {
double t_1 = v * (-t1 / ((t1 + u) * (t1 + u)));
double tmp;
if (t1 <= -3.4e+123) {
tmp = -v / (t1 + u);
} else if (t1 <= -4.5e-148) {
tmp = t_1;
} else if (t1 <= 1.15e-202) {
tmp = v * ((-1.0 / u) * (t1 / u));
} else if (t1 <= 1.05e+119) {
tmp = t_1;
} else {
tmp = v / (u - t1);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: t_1
real(8) :: tmp
t_1 = v * (-t1 / ((t1 + u) * (t1 + u)))
if (t1 <= (-3.4d+123)) then
tmp = -v / (t1 + u)
else if (t1 <= (-4.5d-148)) then
tmp = t_1
else if (t1 <= 1.15d-202) then
tmp = v * (((-1.0d0) / u) * (t1 / u))
else if (t1 <= 1.05d+119) then
tmp = t_1
else
tmp = v / (u - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = v * (-t1 / ((t1 + u) * (t1 + u)));
double tmp;
if (t1 <= -3.4e+123) {
tmp = -v / (t1 + u);
} else if (t1 <= -4.5e-148) {
tmp = t_1;
} else if (t1 <= 1.15e-202) {
tmp = v * ((-1.0 / u) * (t1 / u));
} else if (t1 <= 1.05e+119) {
tmp = t_1;
} else {
tmp = v / (u - t1);
}
return tmp;
}
def code(u, v, t1): t_1 = v * (-t1 / ((t1 + u) * (t1 + u))) tmp = 0 if t1 <= -3.4e+123: tmp = -v / (t1 + u) elif t1 <= -4.5e-148: tmp = t_1 elif t1 <= 1.15e-202: tmp = v * ((-1.0 / u) * (t1 / u)) elif t1 <= 1.05e+119: tmp = t_1 else: tmp = v / (u - t1) return tmp
function code(u, v, t1) t_1 = Float64(v * Float64(Float64(-t1) / Float64(Float64(t1 + u) * Float64(t1 + u)))) tmp = 0.0 if (t1 <= -3.4e+123) tmp = Float64(Float64(-v) / Float64(t1 + u)); elseif (t1 <= -4.5e-148) tmp = t_1; elseif (t1 <= 1.15e-202) tmp = Float64(v * Float64(Float64(-1.0 / u) * Float64(t1 / u))); elseif (t1 <= 1.05e+119) tmp = t_1; else tmp = Float64(v / Float64(u - t1)); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v * (-t1 / ((t1 + u) * (t1 + u))); tmp = 0.0; if (t1 <= -3.4e+123) tmp = -v / (t1 + u); elseif (t1 <= -4.5e-148) tmp = t_1; elseif (t1 <= 1.15e-202) tmp = v * ((-1.0 / u) * (t1 / u)); elseif (t1 <= 1.05e+119) tmp = t_1; else tmp = v / (u - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v * N[((-t1) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -3.4e+123], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, -4.5e-148], t$95$1, If[LessEqual[t1, 1.15e-202], N[(v * N[(N[(-1.0 / u), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.05e+119], t$95$1, N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{if}\;t1 \leq -3.4 \cdot 10^{+123}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{elif}\;t1 \leq -4.5 \cdot 10^{-148}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t1 \leq 1.15 \cdot 10^{-202}:\\
\;\;\;\;v \cdot \left(\frac{-1}{u} \cdot \frac{t1}{u}\right)\\
\mathbf{elif}\;t1 \leq 1.05 \cdot 10^{+119}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u - t1}\\
\end{array}
\end{array}
if t1 < -3.40000000000000001e123Initial program 39.8%
associate-/r*57.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in t1 around inf 93.6%
neg-mul-193.6%
Simplified93.6%
if -3.40000000000000001e123 < t1 < -4.50000000000000015e-148 or 1.1499999999999999e-202 < t1 < 1.04999999999999991e119Initial program 84.0%
associate-*l/88.7%
*-commutative88.7%
Simplified88.7%
if -4.50000000000000015e-148 < t1 < 1.1499999999999999e-202Initial program 75.3%
associate-*l/82.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in t1 around 0 82.5%
associate-*r/82.5%
neg-mul-182.5%
unpow282.5%
Simplified82.5%
neg-mul-182.5%
times-frac90.8%
Applied egg-rr90.8%
if 1.04999999999999991e119 < t1 Initial program 35.8%
associate-/r*60.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t1 around inf 92.9%
neg-mul-192.9%
Simplified92.9%
frac-2neg92.9%
div-inv92.7%
remove-double-neg92.7%
+-commutative92.7%
distribute-neg-in92.7%
add-sqr-sqrt47.7%
sqrt-unprod84.4%
sqr-neg84.4%
sqrt-prod44.9%
add-sqr-sqrt93.0%
Applied egg-rr93.0%
sub-neg93.0%
associate-*r/93.2%
*-rgt-identity93.2%
Simplified93.2%
Final simplification90.8%
(FPCore (u v t1) :precision binary64 (if (<= t1 -4.2e-33) (/ (- v) (+ t1 u)) (if (<= t1 3.45e+16) (* v (/ (- t1) (* u u))) (/ v (- u t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -4.2e-33) {
tmp = -v / (t1 + u);
} else if (t1 <= 3.45e+16) {
tmp = v * (-t1 / (u * u));
} else {
tmp = v / (u - t1);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (t1 <= (-4.2d-33)) then
tmp = -v / (t1 + u)
else if (t1 <= 3.45d+16) then
tmp = v * (-t1 / (u * u))
else
tmp = v / (u - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -4.2e-33) {
tmp = -v / (t1 + u);
} else if (t1 <= 3.45e+16) {
tmp = v * (-t1 / (u * u));
} else {
tmp = v / (u - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -4.2e-33: tmp = -v / (t1 + u) elif t1 <= 3.45e+16: tmp = v * (-t1 / (u * u)) else: tmp = v / (u - t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -4.2e-33) tmp = Float64(Float64(-v) / Float64(t1 + u)); elseif (t1 <= 3.45e+16) tmp = Float64(v * Float64(Float64(-t1) / Float64(u * u))); else tmp = Float64(v / Float64(u - t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -4.2e-33) tmp = -v / (t1 + u); elseif (t1 <= 3.45e+16) tmp = v * (-t1 / (u * u)); else tmp = v / (u - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -4.2e-33], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 3.45e+16], N[(v * N[((-t1) / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4.2 \cdot 10^{-33}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{elif}\;t1 \leq 3.45 \cdot 10^{+16}:\\
\;\;\;\;v \cdot \frac{-t1}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u - t1}\\
\end{array}
\end{array}
if t1 < -4.2e-33Initial program 56.8%
associate-/r*71.3%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t1 around inf 82.4%
neg-mul-182.4%
Simplified82.4%
if -4.2e-33 < t1 < 3.45e16Initial program 79.3%
associate-*l/84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in t1 around 0 75.5%
associate-*r/75.5%
neg-mul-175.5%
unpow275.5%
Simplified75.5%
if 3.45e16 < t1 Initial program 52.4%
associate-/r*69.8%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in t1 around inf 90.3%
neg-mul-190.3%
Simplified90.3%
frac-2neg90.3%
div-inv90.1%
remove-double-neg90.1%
+-commutative90.1%
distribute-neg-in90.1%
add-sqr-sqrt46.7%
sqrt-unprod87.4%
sqr-neg87.4%
sqrt-prod43.3%
add-sqr-sqrt90.2%
Applied egg-rr90.2%
sub-neg90.2%
associate-*r/90.4%
*-rgt-identity90.4%
Simplified90.4%
Final simplification80.9%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.35e-32) (/ (- v) (+ t1 u)) (if (<= t1 5.6e+20) (* (/ v u) (/ t1 (- u))) (/ v (- u t1)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.35e-32) {
tmp = -v / (t1 + u);
} else if (t1 <= 5.6e+20) {
tmp = (v / u) * (t1 / -u);
} else {
tmp = v / (u - t1);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (t1 <= (-1.35d-32)) then
tmp = -v / (t1 + u)
else if (t1 <= 5.6d+20) then
tmp = (v / u) * (t1 / -u)
else
tmp = v / (u - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.35e-32) {
tmp = -v / (t1 + u);
} else if (t1 <= 5.6e+20) {
tmp = (v / u) * (t1 / -u);
} else {
tmp = v / (u - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.35e-32: tmp = -v / (t1 + u) elif t1 <= 5.6e+20: tmp = (v / u) * (t1 / -u) else: tmp = v / (u - t1) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.35e-32) tmp = Float64(Float64(-v) / Float64(t1 + u)); elseif (t1 <= 5.6e+20) tmp = Float64(Float64(v / u) * Float64(t1 / Float64(-u))); else tmp = Float64(v / Float64(u - t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.35e-32) tmp = -v / (t1 + u); elseif (t1 <= 5.6e+20) tmp = (v / u) * (t1 / -u); else tmp = v / (u - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.35e-32], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 5.6e+20], N[(N[(v / u), $MachinePrecision] * N[(t1 / (-u)), $MachinePrecision]), $MachinePrecision], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.35 \cdot 10^{-32}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{elif}\;t1 \leq 5.6 \cdot 10^{+20}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{t1}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u - t1}\\
\end{array}
\end{array}
if t1 < -1.3499999999999999e-32Initial program 56.8%
associate-/r*71.3%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t1 around inf 82.4%
neg-mul-182.4%
Simplified82.4%
if -1.3499999999999999e-32 < t1 < 5.6e20Initial program 79.3%
associate-*l/84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in t1 around 0 75.5%
associate-*r/75.5%
neg-mul-175.5%
unpow275.5%
Simplified75.5%
associate-*r/73.0%
frac-2neg73.0%
add-sqr-sqrt36.6%
sqrt-unprod49.7%
sqr-neg49.7%
sqrt-unprod21.8%
add-sqr-sqrt41.5%
distribute-rgt-neg-out41.5%
add-sqr-sqrt19.7%
sqrt-unprod50.8%
sqr-neg50.8%
sqrt-unprod36.3%
add-sqr-sqrt73.0%
distribute-rgt-neg-in73.0%
Applied egg-rr73.0%
times-frac83.0%
Simplified83.0%
if 5.6e20 < t1 Initial program 52.4%
associate-/r*69.8%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in t1 around inf 90.3%
neg-mul-190.3%
Simplified90.3%
frac-2neg90.3%
div-inv90.1%
remove-double-neg90.1%
+-commutative90.1%
distribute-neg-in90.1%
add-sqr-sqrt46.7%
sqrt-unprod87.4%
sqr-neg87.4%
sqrt-prod43.3%
add-sqr-sqrt90.2%
Applied egg-rr90.2%
sub-neg90.2%
associate-*r/90.4%
*-rgt-identity90.4%
Simplified90.4%
Final simplification84.5%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2.65e+172) (not (<= u 1.52e+66))) (/ v (/ (* u u) t1)) (- (/ v t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2.65e+172) || !(u <= 1.52e+66)) {
tmp = v / ((u * 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) :: tmp
if ((u <= (-2.65d+172)) .or. (.not. (u <= 1.52d+66))) then
tmp = v / ((u * u) / t1)
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.65e+172) || !(u <= 1.52e+66)) {
tmp = v / ((u * u) / t1);
} else {
tmp = -(v / t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2.65e+172) or not (u <= 1.52e+66): tmp = v / ((u * u) / t1) else: tmp = -(v / t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2.65e+172) || !(u <= 1.52e+66)) tmp = Float64(v / Float64(Float64(u * u) / t1)); else tmp = Float64(-Float64(v / t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -2.65e+172) || ~((u <= 1.52e+66))) tmp = v / ((u * u) / t1); else tmp = -(v / t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2.65e+172], N[Not[LessEqual[u, 1.52e+66]], $MachinePrecision]], N[(v / N[(N[(u * u), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision], (-N[(v / t1), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.65 \cdot 10^{+172} \lor \neg \left(u \leq 1.52 \cdot 10^{+66}\right):\\
\;\;\;\;\frac{v}{\frac{u \cdot u}{t1}}\\
\mathbf{else}:\\
\;\;\;\;-\frac{v}{t1}\\
\end{array}
\end{array}
if u < -2.65e172 or 1.52000000000000004e66 < u Initial program 72.9%
associate-*l/72.4%
*-commutative72.4%
Simplified72.4%
Taylor expanded in t1 around 0 69.8%
associate-*r/69.8%
neg-mul-169.8%
unpow269.8%
Simplified69.8%
clear-num69.8%
un-div-inv69.8%
add-sqr-sqrt29.5%
sqrt-unprod57.9%
sqr-neg57.9%
sqrt-unprod37.6%
add-sqr-sqrt65.8%
Applied egg-rr65.8%
if -2.65e172 < u < 1.52000000000000004e66Initial program 64.0%
associate-*l/70.5%
*-commutative70.5%
Simplified70.5%
Taylor expanded in t1 around inf 71.0%
associate-*r/71.0%
neg-mul-171.0%
Simplified71.0%
Final simplification69.5%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.12e+83) (/ v t1) (if (<= t1 1.05e+39) (/ v u) (/ v t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.12e+83) {
tmp = v / t1;
} else if (t1 <= 1.05e+39) {
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 (t1 <= (-1.12d+83)) then
tmp = v / t1
else if (t1 <= 1.05d+39) 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 (t1 <= -1.12e+83) {
tmp = v / t1;
} else if (t1 <= 1.05e+39) {
tmp = v / u;
} else {
tmp = v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.12e+83: tmp = v / t1 elif t1 <= 1.05e+39: tmp = v / u else: tmp = v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.12e+83) tmp = Float64(v / t1); elseif (t1 <= 1.05e+39) tmp = Float64(v / u); else tmp = Float64(v / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.12e+83) tmp = v / t1; elseif (t1 <= 1.05e+39) tmp = v / u; else tmp = v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.12e+83], N[(v / t1), $MachinePrecision], If[LessEqual[t1, 1.05e+39], N[(v / u), $MachinePrecision], N[(v / t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.12 \cdot 10^{+83}:\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{elif}\;t1 \leq 1.05 \cdot 10^{+39}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{t1}\\
\end{array}
\end{array}
if t1 < -1.12e83 or 1.0499999999999999e39 < t1 Initial program 50.3%
associate-/r*67.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in t1 around inf 92.2%
neg-mul-192.2%
Simplified92.2%
clear-num91.7%
associate-/r/92.0%
add-sqr-sqrt49.5%
sqrt-unprod55.7%
sqr-neg55.7%
sqrt-unprod13.2%
add-sqr-sqrt29.7%
Applied egg-rr29.7%
Taylor expanded in t1 around inf 28.6%
if -1.12e83 < t1 < 1.0499999999999999e39Initial program 78.4%
associate-/r*87.7%
associate-/l*94.9%
Simplified94.9%
Taylor expanded in t1 around inf 38.9%
neg-mul-138.9%
Simplified38.9%
frac-2neg38.9%
div-inv38.8%
remove-double-neg38.8%
+-commutative38.8%
distribute-neg-in38.8%
add-sqr-sqrt17.5%
sqrt-unprod50.4%
sqr-neg50.4%
sqrt-prod22.1%
add-sqr-sqrt39.4%
Applied egg-rr39.4%
sub-neg39.4%
associate-*r/39.4%
*-rgt-identity39.4%
Simplified39.4%
Taylor expanded in u around inf 15.9%
Final simplification21.2%
(FPCore (u v t1) :precision binary64 (if (<= u 8.2e+177) (- (/ v t1)) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if (u <= 8.2e+177) {
tmp = -(v / t1);
} else {
tmp = v / u;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= 8.2d+177) then
tmp = -(v / t1)
else
tmp = v / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= 8.2e+177) {
tmp = -(v / t1);
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= 8.2e+177: tmp = -(v / t1) else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= 8.2e+177) tmp = Float64(-Float64(v / t1)); else tmp = Float64(v / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= 8.2e+177) tmp = -(v / t1); else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, 8.2e+177], (-N[(v / t1), $MachinePrecision]), N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq 8.2 \cdot 10^{+177}:\\
\;\;\;\;-\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if u < 8.20000000000000029e177Initial program 66.5%
associate-*l/71.3%
*-commutative71.3%
Simplified71.3%
Taylor expanded in t1 around inf 60.3%
associate-*r/60.3%
neg-mul-160.3%
Simplified60.3%
if 8.20000000000000029e177 < u Initial program 68.3%
associate-/r*91.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t1 around inf 44.3%
neg-mul-144.3%
Simplified44.3%
frac-2neg44.3%
div-inv44.3%
remove-double-neg44.3%
+-commutative44.3%
distribute-neg-in44.3%
add-sqr-sqrt0.0%
sqrt-unprod68.8%
sqr-neg68.8%
sqrt-prod44.4%
add-sqr-sqrt44.4%
Applied egg-rr44.4%
sub-neg44.4%
associate-*r/44.4%
*-rgt-identity44.4%
Simplified44.4%
Taylor expanded in u around inf 40.4%
Final simplification58.5%
(FPCore (u v t1) :precision binary64 (if (<= u 1.16e+178) (- (/ v t1)) (- (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= 1.16e+178) {
tmp = -(v / t1);
} else {
tmp = -(v / u);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= 1.16d+178) then
tmp = -(v / t1)
else
tmp = -(v / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= 1.16e+178) {
tmp = -(v / t1);
} else {
tmp = -(v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= 1.16e+178: tmp = -(v / t1) else: tmp = -(v / u) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= 1.16e+178) tmp = Float64(-Float64(v / t1)); else tmp = Float64(-Float64(v / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= 1.16e+178) tmp = -(v / t1); else tmp = -(v / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, 1.16e+178], (-N[(v / t1), $MachinePrecision]), (-N[(v / u), $MachinePrecision])]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq 1.16 \cdot 10^{+178}:\\
\;\;\;\;-\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;-\frac{v}{u}\\
\end{array}
\end{array}
if u < 1.16000000000000005e178Initial program 66.5%
associate-*l/71.3%
*-commutative71.3%
Simplified71.3%
Taylor expanded in t1 around inf 60.3%
associate-*r/60.3%
neg-mul-160.3%
Simplified60.3%
if 1.16000000000000005e178 < u Initial program 68.3%
associate-/r*91.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in t1 around inf 44.0%
Taylor expanded in t1 around 0 40.4%
associate-*r/40.4%
neg-mul-140.4%
Simplified40.4%
Final simplification58.5%
(FPCore (u v t1) :precision binary64 (/ v (- u t1)))
double code(double u, double v, double t1) {
return v / (u - t1);
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = v / (u - t1)
end function
public static double code(double u, double v, double t1) {
return v / (u - t1);
}
def code(u, v, t1): return v / (u - t1)
function code(u, v, t1) return Float64(v / Float64(u - t1)) end
function tmp = code(u, v, t1) tmp = v / (u - t1); end
code[u_, v_, t1_] := N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u - t1}
\end{array}
Initial program 66.6%
associate-/r*79.1%
associate-/l*97.0%
Simplified97.0%
Taylor expanded in t1 around inf 61.2%
neg-mul-161.2%
Simplified61.2%
frac-2neg61.2%
div-inv61.0%
remove-double-neg61.0%
+-commutative61.0%
distribute-neg-in61.0%
add-sqr-sqrt28.6%
sqrt-unprod66.8%
sqr-neg66.8%
sqrt-prod32.8%
add-sqr-sqrt61.3%
Applied egg-rr61.3%
sub-neg61.3%
associate-*r/61.5%
*-rgt-identity61.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 66.6%
associate-/r*79.1%
associate-/l*97.0%
Simplified97.0%
Taylor expanded in t1 around inf 61.2%
neg-mul-161.2%
Simplified61.2%
clear-num61.2%
associate-/r/61.0%
add-sqr-sqrt30.3%
sqrt-unprod39.7%
sqr-neg39.7%
sqrt-unprod9.7%
add-sqr-sqrt20.2%
Applied egg-rr20.2%
Taylor expanded in t1 around inf 13.1%
Final simplification13.1%
herbie shell --seed 2023274
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))