
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -2e+127) (not (<= v 5e-56)))
(+ t_0 (+ -1.5 (* 0.25 (* (/ r (/ 1.0 w)) (/ w (/ -1.0 r))))))
(-
(+ 3.0 t_0)
(+ 4.5 (/ (* r (* w (+ 0.375 (* v -0.25)))) (/ (- 1.0 v) (* r w))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -2e+127) || !(v <= 5e-56)) {
tmp = t_0 + (-1.5 + (0.25 * ((r / (1.0 / w)) * (w / (-1.0 / r)))));
} else {
tmp = (3.0 + t_0) - (4.5 + ((r * (w * (0.375 + (v * -0.25)))) / ((1.0 - v) / (r * w))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((v <= (-2d+127)) .or. (.not. (v <= 5d-56))) then
tmp = t_0 + ((-1.5d0) + (0.25d0 * ((r / (1.0d0 / w)) * (w / ((-1.0d0) / r)))))
else
tmp = (3.0d0 + t_0) - (4.5d0 + ((r * (w * (0.375d0 + (v * (-0.25d0))))) / ((1.0d0 - v) / (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -2e+127) || !(v <= 5e-56)) {
tmp = t_0 + (-1.5 + (0.25 * ((r / (1.0 / w)) * (w / (-1.0 / r)))));
} else {
tmp = (3.0 + t_0) - (4.5 + ((r * (w * (0.375 + (v * -0.25)))) / ((1.0 - v) / (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -2e+127) or not (v <= 5e-56): tmp = t_0 + (-1.5 + (0.25 * ((r / (1.0 / w)) * (w / (-1.0 / r))))) else: tmp = (3.0 + t_0) - (4.5 + ((r * (w * (0.375 + (v * -0.25)))) / ((1.0 - v) / (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -2e+127) || !(v <= 5e-56)) tmp = Float64(t_0 + Float64(-1.5 + Float64(0.25 * Float64(Float64(r / Float64(1.0 / w)) * Float64(w / Float64(-1.0 / r)))))); else tmp = Float64(Float64(3.0 + t_0) - Float64(4.5 + Float64(Float64(r * Float64(w * Float64(0.375 + Float64(v * -0.25)))) / Float64(Float64(1.0 - v) / Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -2e+127) || ~((v <= 5e-56))) tmp = t_0 + (-1.5 + (0.25 * ((r / (1.0 / w)) * (w / (-1.0 / r))))); else tmp = (3.0 + t_0) - (4.5 + ((r * (w * (0.375 + (v * -0.25)))) / ((1.0 - v) / (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -2e+127], N[Not[LessEqual[v, 5e-56]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 + N[(0.25 * N[(N[(r / N[(1.0 / w), $MachinePrecision]), $MachinePrecision] * N[(w / N[(-1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(4.5 + N[(N[(r * N[(w * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -2 \cdot 10^{+127} \lor \neg \left(v \leq 5 \cdot 10^{-56}\right):\\
\;\;\;\;t\_0 + \left(-1.5 + 0.25 \cdot \left(\frac{r}{\frac{1}{w}} \cdot \frac{w}{\frac{-1}{r}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + t\_0\right) - \left(4.5 + \frac{r \cdot \left(w \cdot \left(0.375 + v \cdot -0.25\right)\right)}{\frac{1 - v}{r \cdot w}}\right)\\
\end{array}
\end{array}
if v < -1.99999999999999991e127 or 4.99999999999999997e-56 < v Initial program 85.5%
Simplified88.7%
Taylor expanded in v around inf 81.3%
*-commutative81.3%
*-commutative81.3%
unpow281.3%
unpow281.3%
swap-sqr99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
*-commutative99.9%
pow299.9%
remove-double-div99.9%
un-div-inv99.8%
Applied egg-rr99.8%
inv-pow99.8%
unpow-prod-down99.9%
inv-pow99.9%
inv-pow99.9%
Applied egg-rr99.9%
*-commutative99.9%
times-frac99.9%
Applied egg-rr99.9%
if -1.99999999999999991e127 < v < 4.99999999999999997e-56Initial program 89.0%
associate--l-89.0%
associate-*l*84.9%
sqr-neg84.9%
associate-*l*89.0%
associate-/l*89.6%
fma-define89.6%
Simplified89.6%
add-sqr-sqrt89.6%
*-un-lft-identity89.6%
times-frac89.6%
*-commutative89.6%
sqrt-prod46.5%
*-commutative46.5%
sqrt-prod46.5%
sqrt-prod25.0%
add-sqr-sqrt36.6%
associate-*r*36.6%
add-sqr-sqrt69.1%
Applied egg-rr99.8%
/-rgt-identity99.8%
associate-*r*99.8%
clear-num99.8%
un-div-inv99.8%
distribute-lft-in99.8%
metadata-eval99.8%
associate-*r*99.8%
metadata-eval99.8%
Applied egg-rr99.8%
Taylor expanded in w around 0 99.8%
Final simplification99.9%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -2000000000000.0) (not (<= v 5e-56)))
(+ t_0 (- -1.5 (* (* (/ w (/ 1.0 r)) (/ r (/ 1.0 w))) 0.25)))
(+ t_0 (+ -1.5 (* 0.375 (/ (* r w) (* (/ 1.0 w) (/ -1.0 r)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -2000000000000.0) || !(v <= 5e-56)) {
tmp = t_0 + (-1.5 - (((w / (1.0 / r)) * (r / (1.0 / w))) * 0.25));
} else {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) / ((1.0 / w) * (-1.0 / r)))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((v <= (-2000000000000.0d0)) .or. (.not. (v <= 5d-56))) then
tmp = t_0 + ((-1.5d0) - (((w / (1.0d0 / r)) * (r / (1.0d0 / w))) * 0.25d0))
else
tmp = t_0 + ((-1.5d0) + (0.375d0 * ((r * w) / ((1.0d0 / w) * ((-1.0d0) / r)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -2000000000000.0) || !(v <= 5e-56)) {
tmp = t_0 + (-1.5 - (((w / (1.0 / r)) * (r / (1.0 / w))) * 0.25));
} else {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) / ((1.0 / w) * (-1.0 / r)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -2000000000000.0) or not (v <= 5e-56): tmp = t_0 + (-1.5 - (((w / (1.0 / r)) * (r / (1.0 / w))) * 0.25)) else: tmp = t_0 + (-1.5 + (0.375 * ((r * w) / ((1.0 / w) * (-1.0 / r))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -2000000000000.0) || !(v <= 5e-56)) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(w / Float64(1.0 / r)) * Float64(r / Float64(1.0 / w))) * 0.25))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(0.375 * Float64(Float64(r * w) / Float64(Float64(1.0 / w) * Float64(-1.0 / r)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -2000000000000.0) || ~((v <= 5e-56))) tmp = t_0 + (-1.5 - (((w / (1.0 / r)) * (r / (1.0 / w))) * 0.25)); else tmp = t_0 + (-1.5 + (0.375 * ((r * w) / ((1.0 / w) * (-1.0 / r))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -2000000000000.0], N[Not[LessEqual[v, 5e-56]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 - N[(N[(N[(w / N[(1.0 / r), $MachinePrecision]), $MachinePrecision] * N[(r / N[(1.0 / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(N[(1.0 / w), $MachinePrecision] * N[(-1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -2000000000000 \lor \neg \left(v \leq 5 \cdot 10^{-56}\right):\\
\;\;\;\;t\_0 + \left(-1.5 - \left(\frac{w}{\frac{1}{r}} \cdot \frac{r}{\frac{1}{w}}\right) \cdot 0.25\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.375 \cdot \frac{r \cdot w}{\frac{1}{w} \cdot \frac{-1}{r}}\right)\\
\end{array}
\end{array}
if v < -2e12 or 4.99999999999999997e-56 < v Initial program 87.0%
Simplified90.2%
Taylor expanded in v around inf 83.5%
*-commutative83.5%
*-commutative83.5%
unpow283.5%
unpow283.5%
swap-sqr99.7%
unpow299.7%
*-commutative99.7%
Simplified99.7%
*-commutative99.7%
pow299.7%
remove-double-div99.7%
un-div-inv99.7%
Applied egg-rr99.7%
inv-pow99.7%
unpow-prod-down99.7%
inv-pow99.7%
inv-pow99.7%
Applied egg-rr99.7%
*-commutative99.7%
times-frac99.8%
Applied egg-rr99.8%
if -2e12 < v < 4.99999999999999997e-56Initial program 88.2%
Simplified88.2%
Taylor expanded in v around 0 82.9%
*-commutative82.9%
unpow282.9%
unpow282.9%
swap-sqr99.4%
unpow299.4%
*-commutative99.4%
Simplified99.4%
*-commutative88.3%
pow288.3%
remove-double-div88.3%
un-div-inv88.3%
Applied egg-rr99.4%
inv-pow88.3%
unpow-prod-down88.3%
inv-pow88.3%
inv-pow88.3%
Applied egg-rr99.4%
Final simplification99.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v -880000000000.0)
(+ t_0 (+ -1.5 (* 0.25 (/ (* r w) (/ (/ -1.0 w) r)))))
(if (<= v 2.5e-55)
(+ t_0 (+ -1.5 (* 0.375 (/ (* r w) (* (/ 1.0 w) (/ -1.0 r))))))
(+ t_0 (- -1.5 (* 0.25 (* (* r w) (* r w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -880000000000.0) {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / ((-1.0 / w) / r))));
} else if (v <= 2.5e-55) {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) / ((1.0 / w) * (-1.0 / r)))));
} else {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (v <= (-880000000000.0d0)) then
tmp = t_0 + ((-1.5d0) + (0.25d0 * ((r * w) / (((-1.0d0) / w) / r))))
else if (v <= 2.5d-55) then
tmp = t_0 + ((-1.5d0) + (0.375d0 * ((r * w) / ((1.0d0 / w) * ((-1.0d0) / r)))))
else
tmp = t_0 + ((-1.5d0) - (0.25d0 * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -880000000000.0) {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / ((-1.0 / w) / r))));
} else if (v <= 2.5e-55) {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) / ((1.0 / w) * (-1.0 / r)))));
} else {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= -880000000000.0: tmp = t_0 + (-1.5 + (0.25 * ((r * w) / ((-1.0 / w) / r)))) elif v <= 2.5e-55: tmp = t_0 + (-1.5 + (0.375 * ((r * w) / ((1.0 / w) * (-1.0 / r))))) else: tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -880000000000.0) tmp = Float64(t_0 + Float64(-1.5 + Float64(0.25 * Float64(Float64(r * w) / Float64(Float64(-1.0 / w) / r))))); elseif (v <= 2.5e-55) tmp = Float64(t_0 + Float64(-1.5 + Float64(0.375 * Float64(Float64(r * w) / Float64(Float64(1.0 / w) * Float64(-1.0 / r)))))); else tmp = Float64(t_0 + Float64(-1.5 - Float64(0.25 * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (v <= -880000000000.0) tmp = t_0 + (-1.5 + (0.25 * ((r * w) / ((-1.0 / w) / r)))); elseif (v <= 2.5e-55) tmp = t_0 + (-1.5 + (0.375 * ((r * w) / ((1.0 / w) * (-1.0 / r))))); else tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -880000000000.0], N[(t$95$0 + N[(-1.5 + N[(0.25 * N[(N[(r * w), $MachinePrecision] / N[(N[(-1.0 / w), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 2.5e-55], N[(t$95$0 + N[(-1.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(N[(1.0 / w), $MachinePrecision] * N[(-1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -880000000000:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.25 \cdot \frac{r \cdot w}{\frac{\frac{-1}{w}}{r}}\right)\\
\mathbf{elif}\;v \leq 2.5 \cdot 10^{-55}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.375 \cdot \frac{r \cdot w}{\frac{1}{w} \cdot \frac{-1}{r}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if v < -8.8e11Initial program 87.3%
Simplified89.6%
Taylor expanded in v around inf 82.0%
*-commutative82.0%
*-commutative82.0%
unpow282.0%
unpow282.0%
swap-sqr99.6%
unpow299.6%
*-commutative99.6%
Simplified99.6%
*-commutative89.2%
pow289.2%
Applied egg-rr99.6%
pow299.6%
metadata-eval99.6%
pow-div99.6%
pow199.6%
inv-pow99.6%
associate-/r*99.7%
Applied egg-rr99.7%
if -8.8e11 < v < 2.5000000000000001e-55Initial program 88.2%
Simplified88.2%
Taylor expanded in v around 0 82.9%
*-commutative82.9%
unpow282.9%
unpow282.9%
swap-sqr99.4%
unpow299.4%
*-commutative99.4%
Simplified99.4%
*-commutative88.3%
pow288.3%
remove-double-div88.3%
un-div-inv88.3%
Applied egg-rr99.4%
inv-pow88.3%
unpow-prod-down88.3%
inv-pow88.3%
inv-pow88.3%
Applied egg-rr99.4%
if 2.5000000000000001e-55 < v Initial program 86.7%
Simplified90.8%
Taylor expanded in v around inf 85.0%
*-commutative85.0%
*-commutative85.0%
unpow285.0%
unpow285.0%
swap-sqr99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
*-commutative91.3%
pow291.3%
Applied egg-rr99.9%
Final simplification99.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -2000000000000.0) (not (<= v 2.5e-55)))
(+ t_0 (- -1.5 (* 0.25 (* (* r w) (* r w)))))
(+ t_0 (+ -1.5 (* 0.375 (/ (* r w) (/ -1.0 (* r w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -2000000000000.0) || !(v <= 2.5e-55)) {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
} else {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) / (-1.0 / (r * w)))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((v <= (-2000000000000.0d0)) .or. (.not. (v <= 2.5d-55))) then
tmp = t_0 + ((-1.5d0) - (0.25d0 * ((r * w) * (r * w))))
else
tmp = t_0 + ((-1.5d0) + (0.375d0 * ((r * w) / ((-1.0d0) / (r * w)))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -2000000000000.0) || !(v <= 2.5e-55)) {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
} else {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) / (-1.0 / (r * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -2000000000000.0) or not (v <= 2.5e-55): tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))) else: tmp = t_0 + (-1.5 + (0.375 * ((r * w) / (-1.0 / (r * w))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -2000000000000.0) || !(v <= 2.5e-55)) tmp = Float64(t_0 + Float64(-1.5 - Float64(0.25 * Float64(Float64(r * w) * Float64(r * w))))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(0.375 * Float64(Float64(r * w) / Float64(-1.0 / Float64(r * w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -2000000000000.0) || ~((v <= 2.5e-55))) tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))); else tmp = t_0 + (-1.5 + (0.375 * ((r * w) / (-1.0 / (r * w))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -2000000000000.0], N[Not[LessEqual[v, 2.5e-55]], $MachinePrecision]], N[(t$95$0 + N[(-1.5 - N[(0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -2000000000000 \lor \neg \left(v \leq 2.5 \cdot 10^{-55}\right):\\
\;\;\;\;t\_0 + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.375 \cdot \frac{r \cdot w}{\frac{-1}{r \cdot w}}\right)\\
\end{array}
\end{array}
if v < -2e12 or 2.5000000000000001e-55 < v Initial program 87.0%
Simplified90.2%
Taylor expanded in v around inf 83.5%
*-commutative83.5%
*-commutative83.5%
unpow283.5%
unpow283.5%
swap-sqr99.7%
unpow299.7%
*-commutative99.7%
Simplified99.7%
*-commutative90.2%
pow290.2%
Applied egg-rr99.7%
if -2e12 < v < 2.5000000000000001e-55Initial program 88.2%
Simplified88.2%
Taylor expanded in v around 0 82.9%
*-commutative82.9%
unpow282.9%
unpow282.9%
swap-sqr99.4%
unpow299.4%
*-commutative99.4%
Simplified99.4%
*-commutative88.3%
pow288.3%
remove-double-div88.3%
un-div-inv88.3%
Applied egg-rr99.4%
Final simplification99.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v -880000000000.0)
(+ t_0 (+ -1.5 (* 0.25 (/ (* r w) (/ (/ -1.0 w) r)))))
(if (<= v 2e-58)
(+ t_0 (+ -1.5 (* 0.375 (/ (* r w) (/ -1.0 (* r w))))))
(+ t_0 (- -1.5 (* 0.25 (* (* r w) (* r w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -880000000000.0) {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / ((-1.0 / w) / r))));
} else if (v <= 2e-58) {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) / (-1.0 / (r * w)))));
} else {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (v <= (-880000000000.0d0)) then
tmp = t_0 + ((-1.5d0) + (0.25d0 * ((r * w) / (((-1.0d0) / w) / r))))
else if (v <= 2d-58) then
tmp = t_0 + ((-1.5d0) + (0.375d0 * ((r * w) / ((-1.0d0) / (r * w)))))
else
tmp = t_0 + ((-1.5d0) - (0.25d0 * ((r * w) * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -880000000000.0) {
tmp = t_0 + (-1.5 + (0.25 * ((r * w) / ((-1.0 / w) / r))));
} else if (v <= 2e-58) {
tmp = t_0 + (-1.5 + (0.375 * ((r * w) / (-1.0 / (r * w)))));
} else {
tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= -880000000000.0: tmp = t_0 + (-1.5 + (0.25 * ((r * w) / ((-1.0 / w) / r)))) elif v <= 2e-58: tmp = t_0 + (-1.5 + (0.375 * ((r * w) / (-1.0 / (r * w))))) else: tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -880000000000.0) tmp = Float64(t_0 + Float64(-1.5 + Float64(0.25 * Float64(Float64(r * w) / Float64(Float64(-1.0 / w) / r))))); elseif (v <= 2e-58) tmp = Float64(t_0 + Float64(-1.5 + Float64(0.375 * Float64(Float64(r * w) / Float64(-1.0 / Float64(r * w)))))); else tmp = Float64(t_0 + Float64(-1.5 - Float64(0.25 * Float64(Float64(r * w) * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (v <= -880000000000.0) tmp = t_0 + (-1.5 + (0.25 * ((r * w) / ((-1.0 / w) / r)))); elseif (v <= 2e-58) tmp = t_0 + (-1.5 + (0.375 * ((r * w) / (-1.0 / (r * w))))); else tmp = t_0 + (-1.5 - (0.25 * ((r * w) * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[v, -880000000000.0], N[(t$95$0 + N[(-1.5 + N[(0.25 * N[(N[(r * w), $MachinePrecision] / N[(N[(-1.0 / w), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 2e-58], N[(t$95$0 + N[(-1.5 + N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.25 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -880000000000:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.25 \cdot \frac{r \cdot w}{\frac{\frac{-1}{w}}{r}}\right)\\
\mathbf{elif}\;v \leq 2 \cdot 10^{-58}:\\
\;\;\;\;t\_0 + \left(-1.5 + 0.375 \cdot \frac{r \cdot w}{\frac{-1}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.25 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if v < -8.8e11Initial program 87.3%
Simplified89.6%
Taylor expanded in v around inf 82.0%
*-commutative82.0%
*-commutative82.0%
unpow282.0%
unpow282.0%
swap-sqr99.6%
unpow299.6%
*-commutative99.6%
Simplified99.6%
*-commutative89.2%
pow289.2%
Applied egg-rr99.6%
pow299.6%
metadata-eval99.6%
pow-div99.6%
pow199.6%
inv-pow99.6%
associate-/r*99.7%
Applied egg-rr99.7%
if -8.8e11 < v < 2.0000000000000001e-58Initial program 88.2%
Simplified88.2%
Taylor expanded in v around 0 82.9%
*-commutative82.9%
unpow282.9%
unpow282.9%
swap-sqr99.4%
unpow299.4%
*-commutative99.4%
Simplified99.4%
*-commutative88.3%
pow288.3%
remove-double-div88.3%
un-div-inv88.3%
Applied egg-rr99.4%
if 2.0000000000000001e-58 < v Initial program 86.7%
Simplified90.8%
Taylor expanded in v around inf 85.0%
*-commutative85.0%
*-commutative85.0%
unpow285.0%
unpow285.0%
swap-sqr99.9%
unpow299.9%
*-commutative99.9%
Simplified99.9%
*-commutative91.3%
pow291.3%
Applied egg-rr99.9%
Final simplification99.6%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) (+ (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ (* r w) (- 1.0 v)))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))) + 4.5);
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * ((r * w) / (1.0d0 - v)))) + 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))) + 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))) + 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(1.0 - v)))) + 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * ((r * w) / (1.0 - v)))) + 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{1 - v}\right) + 4.5\right)
\end{array}
Initial program 87.6%
associate--l-87.6%
associate-*l*82.7%
sqr-neg82.7%
associate-*l*87.6%
associate-/l*89.3%
fma-define89.3%
Simplified89.3%
add-sqr-sqrt89.2%
*-un-lft-identity89.2%
times-frac89.2%
*-commutative89.2%
sqrt-prod48.2%
*-commutative48.2%
sqrt-prod48.2%
sqrt-prod25.3%
add-sqr-sqrt38.0%
associate-*r*38.0%
add-sqr-sqrt72.2%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* w (* (* r w) (/ r (+ v -1.0))))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * (w * ((r * w) * (r / (v + -1.0))))) - 4.5);
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * (w * ((r * w) * (r / (v + (-1.0d0)))))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * (w * ((r * w) * (r / (v + -1.0))))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * (w * ((r * w) * (r / (v + -1.0))))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(w * Float64(Float64(r * w) * Float64(r / Float64(v + -1.0))))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * (w * ((r * w) * (r / (v + -1.0))))) - 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(N[(r * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot \frac{r}{v + -1}\right)\right) - 4.5\right)
\end{array}
Initial program 87.6%
associate--l-87.6%
associate-*l*82.7%
sqr-neg82.7%
associate-*l*87.6%
associate-/l*89.3%
fma-define89.3%
Simplified89.3%
div-inv89.3%
*-commutative89.3%
associate-*r*89.2%
div-inv89.2%
*-commutative89.2%
associate-*l*97.6%
add-sqr-sqrt52.3%
associate-*r*52.3%
add-sqr-sqrt28.1%
sqrt-prod38.0%
sqrt-prod38.0%
*-commutative38.0%
sqrt-prod72.2%
*-commutative72.2%
associate-*l*72.2%
Applied egg-rr98.0%
Final simplification98.0%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ w (/ (+ v -1.0) r)))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5);
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w / ((v + (-1.0d0)) / r)))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w / Float64(Float64(v + -1.0) / r)))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(w / N[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{w}{\frac{v + -1}{r}}\right) - 4.5\right)
\end{array}
Initial program 87.6%
associate--l-87.6%
associate-*l*82.7%
sqr-neg82.7%
associate-*l*87.6%
associate-/l*89.3%
fma-define89.3%
Simplified89.3%
associate-/l*89.3%
*-commutative89.3%
associate-*r/89.2%
associate-*l*97.8%
associate-*r*99.4%
add-sqr-sqrt53.0%
associate-*l*53.0%
add-sqr-sqrt28.0%
sqrt-prod38.0%
sqrt-prod38.0%
sqrt-prod72.2%
*-commutative72.2%
sqrt-prod38.0%
*-commutative38.0%
sqrt-prod38.0%
sqrt-prod28.0%
add-sqr-sqrt53.0%
associate-*r*53.0%
add-sqr-sqrt99.4%
clear-num99.4%
un-div-inv99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (* r w) (* r w))) (t_1 (/ 2.0 (* r r))))
(if (or (<= v -880000000000.0) (not (<= v 2e-58)))
(+ t_1 (- -1.5 (* 0.25 t_0)))
(+ t_1 (- -1.5 (* 0.375 t_0))))))
double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -880000000000.0) || !(v <= 2e-58)) {
tmp = t_1 + (-1.5 - (0.25 * t_0));
} else {
tmp = t_1 + (-1.5 - (0.375 * t_0));
}
return tmp;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (r * w) * (r * w)
t_1 = 2.0d0 / (r * r)
if ((v <= (-880000000000.0d0)) .or. (.not. (v <= 2d-58))) then
tmp = t_1 + ((-1.5d0) - (0.25d0 * t_0))
else
tmp = t_1 + ((-1.5d0) - (0.375d0 * t_0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (r * w) * (r * w);
double t_1 = 2.0 / (r * r);
double tmp;
if ((v <= -880000000000.0) || !(v <= 2e-58)) {
tmp = t_1 + (-1.5 - (0.25 * t_0));
} else {
tmp = t_1 + (-1.5 - (0.375 * t_0));
}
return tmp;
}
def code(v, w, r): t_0 = (r * w) * (r * w) t_1 = 2.0 / (r * r) tmp = 0 if (v <= -880000000000.0) or not (v <= 2e-58): tmp = t_1 + (-1.5 - (0.25 * t_0)) else: tmp = t_1 + (-1.5 - (0.375 * t_0)) return tmp
function code(v, w, r) t_0 = Float64(Float64(r * w) * Float64(r * w)) t_1 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -880000000000.0) || !(v <= 2e-58)) tmp = Float64(t_1 + Float64(-1.5 - Float64(0.25 * t_0))); else tmp = Float64(t_1 + Float64(-1.5 - Float64(0.375 * t_0))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (r * w) * (r * w); t_1 = 2.0 / (r * r); tmp = 0.0; if ((v <= -880000000000.0) || ~((v <= 2e-58))) tmp = t_1 + (-1.5 - (0.25 * t_0)); else tmp = t_1 + (-1.5 - (0.375 * t_0)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[v, -880000000000.0], N[Not[LessEqual[v, 2e-58]], $MachinePrecision]], N[(t$95$1 + N[(-1.5 - N[(0.25 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(-1.5 - N[(0.375 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(r \cdot w\right) \cdot \left(r \cdot w\right)\\
t_1 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -880000000000 \lor \neg \left(v \leq 2 \cdot 10^{-58}\right):\\
\;\;\;\;t\_1 + \left(-1.5 - 0.25 \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + \left(-1.5 - 0.375 \cdot t\_0\right)\\
\end{array}
\end{array}
if v < -8.8e11 or 2.0000000000000001e-58 < v Initial program 87.0%
Simplified90.2%
Taylor expanded in v around inf 83.5%
*-commutative83.5%
*-commutative83.5%
unpow283.5%
unpow283.5%
swap-sqr99.7%
unpow299.7%
*-commutative99.7%
Simplified99.7%
*-commutative90.2%
pow290.2%
Applied egg-rr99.7%
if -8.8e11 < v < 2.0000000000000001e-58Initial program 88.2%
Simplified88.2%
Taylor expanded in v around 0 82.9%
*-commutative82.9%
unpow282.9%
unpow282.9%
swap-sqr99.4%
unpow299.4%
*-commutative99.4%
Simplified99.4%
*-commutative99.4%
pow299.4%
Applied egg-rr99.4%
Final simplification99.6%
(FPCore (v w r) :precision binary64 (+ (+ 3.0 (/ 2.0 (* r r))) (- (/ (* (* r w) (+ 0.375 (* v -0.25))) (/ (+ v -1.0) (* r w))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + ((((r * w) * (0.375 + (v * -0.25))) / ((v + -1.0) / (r * w))) - 4.5);
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) + ((((r * w) * (0.375d0 + (v * (-0.25d0)))) / ((v + (-1.0d0)) / (r * w))) - 4.5d0)
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + ((((r * w) * (0.375 + (v * -0.25))) / ((v + -1.0) / (r * w))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + ((((r * w) * (0.375 + (v * -0.25))) / ((v + -1.0) / (r * w))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(Float64(r * w) * Float64(0.375 + Float64(v * -0.25))) / Float64(Float64(v + -1.0) / Float64(r * w))) - 4.5)) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) + ((((r * w) * (0.375 + (v * -0.25))) / ((v + -1.0) / (r * w))) - 4.5); end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(r * w), $MachinePrecision] * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\frac{\left(r \cdot w\right) \cdot \left(0.375 + v \cdot -0.25\right)}{\frac{v + -1}{r \cdot w}} - 4.5\right)
\end{array}
Initial program 87.6%
associate--l-87.6%
associate-*l*82.7%
sqr-neg82.7%
associate-*l*87.6%
associate-/l*89.3%
fma-define89.3%
Simplified89.3%
add-sqr-sqrt89.2%
*-un-lft-identity89.2%
times-frac89.2%
*-commutative89.2%
sqrt-prod48.2%
*-commutative48.2%
sqrt-prod48.2%
sqrt-prod25.3%
add-sqr-sqrt38.0%
associate-*r*38.0%
add-sqr-sqrt72.2%
Applied egg-rr99.8%
/-rgt-identity99.8%
associate-*r*97.6%
clear-num97.3%
un-div-inv97.4%
distribute-lft-in97.4%
metadata-eval97.4%
associate-*r*97.4%
metadata-eval97.4%
Applied egg-rr97.4%
Final simplification97.4%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (* 0.375 (* (* r w) (* r w))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (0.375 * ((r * w) * (r * w))));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (2.0d0 / (r * r)) + ((-1.5d0) - (0.375d0 * ((r * w) * (r * w))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (0.375 * ((r * w) * (r * w))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (0.375 * ((r * w) * (r * w))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (0.375 * ((r * w) * (r * w)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - 0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)\right)
\end{array}
Initial program 87.6%
Simplified89.2%
Taylor expanded in v around 0 82.0%
*-commutative82.0%
unpow282.0%
unpow282.0%
swap-sqr94.7%
unpow294.7%
*-commutative94.7%
Simplified94.7%
*-commutative94.7%
pow294.7%
Applied egg-rr94.7%
Final simplification94.7%
(FPCore (v w r) :precision binary64 (- (+ 3.0 (/ 2.0 (* r r))) 4.5))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (3.0d0 + (2.0d0 / (r * r))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) - 4.5;
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) - 4.5
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - 4.5) end
function tmp = code(v, w, r) tmp = (3.0 + (2.0 / (r * r))) - 4.5; end
code[v_, w_, r_] := N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) - 4.5
\end{array}
Initial program 87.6%
Simplified82.6%
Taylor expanded in r around 0 56.6%
Final simplification56.6%
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
return -1.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = -1.5d0
end function
public static double code(double v, double w, double r) {
return -1.5;
}
def code(v, w, r): return -1.5
function code(v, w, r) return -1.5 end
function tmp = code(v, w, r) tmp = -1.5; end
code[v_, w_, r_] := -1.5
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 87.6%
Simplified82.6%
Taylor expanded in r around 0 56.6%
Taylor expanded in r around inf 13.3%
Final simplification13.3%
herbie shell --seed 2024096
(FPCore (v w r)
:name "Rosa's TurbineBenchmark"
:precision binary64
(- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))