
(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 11 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
(if (<= (* w w) 5e+263)
(+
(* 2.0 (pow r -2.0))
(- -1.5 (* (* r (* w (* r w))) (/ (+ 0.375 (* v -0.25)) (- 1.0 v)))))
(+ -4.5 (- (+ 3.0 (/ 2.0 (* r r))) (* (* w (* r (* r w))) 0.25)))))
double code(double v, double w, double r) {
double tmp;
if ((w * w) <= 5e+263) {
tmp = (2.0 * pow(r, -2.0)) + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} else {
tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((w * (r * (r * w))) * 0.25));
}
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) :: tmp
if ((w * w) <= 5d+263) then
tmp = (2.0d0 * (r ** (-2.0d0))) + ((-1.5d0) - ((r * (w * (r * w))) * ((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v))))
else
tmp = (-4.5d0) + ((3.0d0 + (2.0d0 / (r * r))) - ((w * (r * (r * w))) * 0.25d0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((w * w) <= 5e+263) {
tmp = (2.0 * Math.pow(r, -2.0)) + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} else {
tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((w * (r * (r * w))) * 0.25));
}
return tmp;
}
def code(v, w, r): tmp = 0 if (w * w) <= 5e+263: tmp = (2.0 * math.pow(r, -2.0)) + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))) else: tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((w * (r * (r * w))) * 0.25)) return tmp
function code(v, w, r) tmp = 0.0 if (Float64(w * w) <= 5e+263) tmp = Float64(Float64(2.0 * (r ^ -2.0)) + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v))))); else tmp = Float64(-4.5 + Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(w * Float64(r * Float64(r * w))) * 0.25))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((w * w) <= 5e+263) tmp = (2.0 * (r ^ -2.0)) + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))); else tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((w * (r * (r * w))) * 0.25)); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[N[(w * w), $MachinePrecision], 5e+263], N[(N[(2.0 * N[Power[r, -2.0], $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(w * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \cdot w \leq 5 \cdot 10^{+263}:\\
\;\;\;\;2 \cdot {r}^{-2} + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(w \cdot \left(r \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 5.00000000000000022e263Initial program 91.3%
associate--l-91.3%
+-commutative91.3%
associate--l+91.3%
+-commutative91.3%
associate--r+91.3%
metadata-eval91.3%
associate-*l/95.3%
*-commutative95.3%
*-commutative95.3%
*-commutative95.3%
Simplified95.8%
Taylor expanded in r around 0 95.8%
*-commutative95.8%
unpow295.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
div-inv99.8%
pow299.8%
pow-flip99.9%
metadata-eval99.9%
Applied egg-rr99.9%
if 5.00000000000000022e263 < (*.f64 w w) Initial program 76.3%
sub-neg76.3%
associate-/l*76.3%
cancel-sign-sub-inv76.3%
metadata-eval76.3%
*-commutative76.3%
*-commutative76.3%
metadata-eval76.3%
Simplified76.3%
Taylor expanded in v around inf 76.3%
*-commutative76.3%
*-commutative76.3%
unpow276.3%
unpow276.3%
swap-sqr98.8%
unpow298.8%
*-commutative98.8%
Simplified98.8%
*-commutative98.8%
pow298.8%
associate-*r*98.9%
Applied egg-rr98.9%
Final simplification99.6%
(FPCore (v w r)
:precision binary64
(+
(-
(+ 3.0 (/ 2.0 (* r r)))
(/
(* 0.125 (+ 3.0 (* -2.0 v)))
(pow (/ (* (* r w) (* r w)) (- 1.0 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))) / pow((((r * w) * (r * w)) / (1.0 - 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))) / ((((r * w) * (r * w)) / (1.0d0 - 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))) / Math.pow((((r * w) * (r * w)) / (1.0 - v)), -1.0))) + -4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - ((0.125 * (3.0 + (-2.0 * v))) / math.pow((((r * w) * (r * w)) / (1.0 - v)), -1.0))) + -4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) / (Float64(Float64(Float64(r * w) * Float64(r * w)) / Float64(1.0 - 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))) / ((((r * w) * (r * w)) / (1.0 - v)) ^ -1.0))) + -4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(0.125 * N[(3.0 + N[(-2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{0.125 \cdot \left(3 + -2 \cdot v\right)}{{\left(\frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{1 - v}\right)}^{-1}}\right) + -4.5
\end{array}
Initial program 87.1%
sub-neg87.1%
associate-/l*90.0%
cancel-sign-sub-inv90.0%
metadata-eval90.0%
*-commutative90.0%
*-commutative90.0%
metadata-eval90.0%
Simplified90.0%
clear-num90.0%
inv-pow90.0%
associate-*r*81.8%
unswap-sqr99.4%
pow299.4%
Applied egg-rr99.4%
unpow299.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= (* w w) 5e+263)
(+
t_0
(- -1.5 (* (/ (+ 0.375 (* v -0.25)) (- 1.0 v)) (* r (* r (* w w))))))
(+ -4.5 (- (+ 3.0 t_0) (* (* w (* r (* r w))) 0.25))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 5e+263) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = -4.5 + ((3.0 + t_0) - ((w * (r * (r * w))) * 0.25));
}
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 ((w * w) <= 5d+263) then
tmp = t_0 + ((-1.5d0) - (((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)) * (r * (r * (w * w)))))
else
tmp = (-4.5d0) + ((3.0d0 + t_0) - ((w * (r * (r * w))) * 0.25d0))
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 ((w * w) <= 5e+263) {
tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w)))));
} else {
tmp = -4.5 + ((3.0 + t_0) - ((w * (r * (r * w))) * 0.25));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (w * w) <= 5e+263: tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))) else: tmp = -4.5 + ((3.0 + t_0) - ((w * (r * (r * w))) * 0.25)) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(w * w) <= 5e+263) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v)) * Float64(r * Float64(r * Float64(w * w)))))); else tmp = Float64(-4.5 + Float64(Float64(3.0 + t_0) - Float64(Float64(w * Float64(r * Float64(r * w))) * 0.25))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((w * w) <= 5e+263) tmp = t_0 + (-1.5 - (((0.375 + (v * -0.25)) / (1.0 - v)) * (r * (r * (w * w))))); else tmp = -4.5 + ((3.0 + t_0) - ((w * (r * (r * w))) * 0.25)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(w * w), $MachinePrecision], 5e+263], N[(t$95$0 + N[(-1.5 - N[(N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(w * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 5 \cdot 10^{+263}:\\
\;\;\;\;t_0 + \left(-1.5 - \frac{0.375 + v \cdot -0.25}{1 - v} \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(\left(3 + t_0\right) - \left(w \cdot \left(r \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 5.00000000000000022e263Initial program 91.3%
associate--l-91.3%
+-commutative91.3%
associate--l+91.3%
+-commutative91.3%
associate--r+91.3%
metadata-eval91.3%
associate-*l/95.3%
*-commutative95.3%
*-commutative95.3%
*-commutative95.3%
Simplified95.8%
if 5.00000000000000022e263 < (*.f64 w w) Initial program 76.3%
sub-neg76.3%
associate-/l*76.3%
cancel-sign-sub-inv76.3%
metadata-eval76.3%
*-commutative76.3%
*-commutative76.3%
metadata-eval76.3%
Simplified76.3%
Taylor expanded in v around inf 76.3%
*-commutative76.3%
*-commutative76.3%
unpow276.3%
unpow276.3%
swap-sqr98.8%
unpow298.8%
*-commutative98.8%
Simplified98.8%
*-commutative98.8%
pow298.8%
associate-*r*98.9%
Applied egg-rr98.9%
Final simplification96.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= (* w w) 5e+263)
(+
t_0
(- -1.5 (* (* r (* w (* r w))) (/ (+ 0.375 (* v -0.25)) (- 1.0 v)))))
(+ -4.5 (- (+ 3.0 t_0) (* (* w (* r (* r w))) 0.25))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 5e+263) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} else {
tmp = -4.5 + ((3.0 + t_0) - ((w * (r * (r * w))) * 0.25));
}
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 ((w * w) <= 5d+263) then
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * ((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v))))
else
tmp = (-4.5d0) + ((3.0d0 + t_0) - ((w * (r * (r * w))) * 0.25d0))
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 ((w * w) <= 5e+263) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v))));
} else {
tmp = -4.5 + ((3.0 + t_0) - ((w * (r * (r * w))) * 0.25));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (w * w) <= 5e+263: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))) else: tmp = -4.5 + ((3.0 + t_0) - ((w * (r * (r * w))) * 0.25)) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(w * w) <= 5e+263) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v))))); else tmp = Float64(-4.5 + Float64(Float64(3.0 + t_0) - Float64(Float64(w * Float64(r * Float64(r * w))) * 0.25))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((w * w) <= 5e+263) tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))); else tmp = -4.5 + ((3.0 + t_0) - ((w * (r * (r * w))) * 0.25)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(w * w), $MachinePrecision], 5e+263], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(w * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 5 \cdot 10^{+263}:\\
\;\;\;\;t_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right)\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(\left(3 + t_0\right) - \left(w \cdot \left(r \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 5.00000000000000022e263Initial program 91.3%
associate--l-91.3%
+-commutative91.3%
associate--l+91.3%
+-commutative91.3%
associate--r+91.3%
metadata-eval91.3%
associate-*l/95.3%
*-commutative95.3%
*-commutative95.3%
*-commutative95.3%
Simplified95.8%
Taylor expanded in r around 0 95.8%
*-commutative95.8%
unpow295.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
if 5.00000000000000022e263 < (*.f64 w w) Initial program 76.3%
sub-neg76.3%
associate-/l*76.3%
cancel-sign-sub-inv76.3%
metadata-eval76.3%
*-commutative76.3%
*-commutative76.3%
metadata-eval76.3%
Simplified76.3%
Taylor expanded in v around inf 76.3%
*-commutative76.3%
*-commutative76.3%
unpow276.3%
unpow276.3%
swap-sqr98.8%
unpow298.8%
*-commutative98.8%
Simplified98.8%
*-commutative98.8%
pow298.8%
associate-*r*98.9%
Applied egg-rr98.9%
Final simplification99.5%
(FPCore (v w r)
:precision binary64
(if (<= (* w w) 5e+263)
(+
(- -1.5 (* (* r (* w (* r w))) (/ (+ 0.375 (* v -0.25)) (- 1.0 v))))
(/ (/ 2.0 r) r))
(+ -4.5 (- (+ 3.0 (/ 2.0 (* r r))) (* (* w (* r (* r w))) 0.25)))))
double code(double v, double w, double r) {
double tmp;
if ((w * w) <= 5e+263) {
tmp = (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))) + ((2.0 / r) / r);
} else {
tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((w * (r * (r * w))) * 0.25));
}
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) :: tmp
if ((w * w) <= 5d+263) then
tmp = ((-1.5d0) - ((r * (w * (r * w))) * ((0.375d0 + (v * (-0.25d0))) / (1.0d0 - v)))) + ((2.0d0 / r) / r)
else
tmp = (-4.5d0) + ((3.0d0 + (2.0d0 / (r * r))) - ((w * (r * (r * w))) * 0.25d0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((w * w) <= 5e+263) {
tmp = (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))) + ((2.0 / r) / r);
} else {
tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((w * (r * (r * w))) * 0.25));
}
return tmp;
}
def code(v, w, r): tmp = 0 if (w * w) <= 5e+263: tmp = (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))) + ((2.0 / r) / r) else: tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((w * (r * (r * w))) * 0.25)) return tmp
function code(v, w, r) tmp = 0.0 if (Float64(w * w) <= 5e+263) tmp = Float64(Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * Float64(Float64(0.375 + Float64(v * -0.25)) / Float64(1.0 - v)))) + Float64(Float64(2.0 / r) / r)); else tmp = Float64(-4.5 + Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(w * Float64(r * Float64(r * w))) * 0.25))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((w * w) <= 5e+263) tmp = (-1.5 - ((r * (w * (r * w))) * ((0.375 + (v * -0.25)) / (1.0 - v)))) + ((2.0 / r) / r); else tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - ((w * (r * (r * w))) * 0.25)); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[N[(w * w), $MachinePrecision], 5e+263], N[(N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision], N[(-4.5 + N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(w * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \cdot w \leq 5 \cdot 10^{+263}:\\
\;\;\;\;\left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot \frac{0.375 + v \cdot -0.25}{1 - v}\right) + \frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;-4.5 + \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(w \cdot \left(r \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 5.00000000000000022e263Initial program 91.3%
associate--l-91.3%
+-commutative91.3%
associate--l+91.3%
+-commutative91.3%
associate--r+91.3%
metadata-eval91.3%
associate-*l/95.3%
*-commutative95.3%
*-commutative95.3%
*-commutative95.3%
Simplified95.8%
Taylor expanded in r around 0 95.8%
*-commutative95.8%
unpow295.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
div-inv99.8%
pow299.8%
pow-flip99.9%
metadata-eval99.9%
Applied egg-rr99.9%
metadata-eval99.9%
pow-flip99.8%
pow299.8%
div-inv99.8%
associate-/r*99.8%
Applied egg-rr99.8%
if 5.00000000000000022e263 < (*.f64 w w) Initial program 76.3%
sub-neg76.3%
associate-/l*76.3%
cancel-sign-sub-inv76.3%
metadata-eval76.3%
*-commutative76.3%
*-commutative76.3%
metadata-eval76.3%
Simplified76.3%
Taylor expanded in v around inf 76.3%
*-commutative76.3%
*-commutative76.3%
unpow276.3%
unpow276.3%
swap-sqr98.8%
unpow298.8%
*-commutative98.8%
Simplified98.8%
*-commutative98.8%
pow298.8%
associate-*r*98.9%
Applied egg-rr98.9%
Final simplification99.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r -1.95e+167)
(* (* (* r w) (* r w)) -0.375)
(if (or (<= r -1.4e-83) (not (<= r 6.6e-170)))
(+ t_0 (- (* -0.375 (* (* r r) (* w w))) 1.5))
t_0))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= -1.95e+167) {
tmp = ((r * w) * (r * w)) * -0.375;
} else if ((r <= -1.4e-83) || !(r <= 6.6e-170)) {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
} else {
tmp = 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) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= (-1.95d+167)) then
tmp = ((r * w) * (r * w)) * (-0.375d0)
else if ((r <= (-1.4d-83)) .or. (.not. (r <= 6.6d-170))) then
tmp = t_0 + (((-0.375d0) * ((r * r) * (w * w))) - 1.5d0)
else
tmp = t_0
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 (r <= -1.95e+167) {
tmp = ((r * w) * (r * w)) * -0.375;
} else if ((r <= -1.4e-83) || !(r <= 6.6e-170)) {
tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5);
} else {
tmp = t_0;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= -1.95e+167: tmp = ((r * w) * (r * w)) * -0.375 elif (r <= -1.4e-83) or not (r <= 6.6e-170): tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5) else: tmp = t_0 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= -1.95e+167) tmp = Float64(Float64(Float64(r * w) * Float64(r * w)) * -0.375); elseif ((r <= -1.4e-83) || !(r <= 6.6e-170)) tmp = Float64(t_0 + Float64(Float64(-0.375 * Float64(Float64(r * r) * Float64(w * w))) - 1.5)); else tmp = t_0; end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= -1.95e+167) tmp = ((r * w) * (r * w)) * -0.375; elseif ((r <= -1.4e-83) || ~((r <= 6.6e-170))) tmp = t_0 + ((-0.375 * ((r * r) * (w * w))) - 1.5); else tmp = t_0; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, -1.95e+167], N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision], If[Or[LessEqual[r, -1.4e-83], N[Not[LessEqual[r, 6.6e-170]], $MachinePrecision]], N[(t$95$0 + N[(N[(-0.375 * N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq -1.95 \cdot 10^{+167}:\\
\;\;\;\;\left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot -0.375\\
\mathbf{elif}\;r \leq -1.4 \cdot 10^{-83} \lor \neg \left(r \leq 6.6 \cdot 10^{-170}\right):\\
\;\;\;\;t_0 + \left(-0.375 \cdot \left(\left(r \cdot r\right) \cdot \left(w \cdot w\right)\right) - 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if r < -1.9499999999999999e167Initial program 77.0%
sub-neg77.0%
associate-/l*82.8%
cancel-sign-sub-inv82.8%
metadata-eval82.8%
*-commutative82.8%
*-commutative82.8%
metadata-eval82.8%
Simplified82.8%
Taylor expanded in v around 0 48.3%
*-commutative48.3%
*-commutative48.3%
unpow248.3%
unpow248.3%
swap-sqr90.2%
unpow290.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in r around inf 48.3%
*-commutative48.3%
unpow248.3%
unpow248.3%
swap-sqr75.1%
unpow275.1%
*-commutative75.1%
Simplified75.1%
*-commutative75.1%
pow275.1%
Applied egg-rr75.1%
if -1.9499999999999999e167 < r < -1.4e-83 or 6.60000000000000007e-170 < r Initial program 93.3%
sub-neg93.3%
+-commutative93.3%
associate--l+93.3%
associate-/l*96.8%
distribute-neg-frac96.8%
associate-/r/96.8%
fma-def96.8%
sub-neg96.8%
Simplified91.3%
Taylor expanded in v around 0 86.8%
associate--l+86.8%
associate-*r/86.8%
metadata-eval86.8%
unpow286.8%
*-commutative86.8%
unpow286.8%
unpow286.8%
Simplified86.8%
if -1.4e-83 < r < 6.60000000000000007e-170Initial program 77.2%
sub-neg77.2%
associate-/l*77.2%
cancel-sign-sub-inv77.2%
metadata-eval77.2%
*-commutative77.2%
*-commutative77.2%
metadata-eval77.2%
Simplified77.2%
Taylor expanded in v around 0 77.2%
*-commutative77.2%
*-commutative77.2%
unpow277.2%
unpow277.2%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in r around 0 99.8%
unpow299.8%
Simplified99.8%
Final simplification88.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (* (* r r) (* w w))))
(if (<= r -1.95e+167)
(* (* (* r w) (* r w)) -0.375)
(if (<= r -5.2e-84)
(+ t_0 (- (* -0.25 t_1) 1.5))
(if (<= r 6.6e-170) t_0 (+ t_0 (- (* -0.375 t_1) 1.5)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (r * r) * (w * w);
double tmp;
if (r <= -1.95e+167) {
tmp = ((r * w) * (r * w)) * -0.375;
} else if (r <= -5.2e-84) {
tmp = t_0 + ((-0.25 * t_1) - 1.5);
} else if (r <= 6.6e-170) {
tmp = t_0;
} else {
tmp = t_0 + ((-0.375 * t_1) - 1.5);
}
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 = 2.0d0 / (r * r)
t_1 = (r * r) * (w * w)
if (r <= (-1.95d+167)) then
tmp = ((r * w) * (r * w)) * (-0.375d0)
else if (r <= (-5.2d-84)) then
tmp = t_0 + (((-0.25d0) * t_1) - 1.5d0)
else if (r <= 6.6d-170) then
tmp = t_0
else
tmp = t_0 + (((-0.375d0) * t_1) - 1.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = (r * r) * (w * w);
double tmp;
if (r <= -1.95e+167) {
tmp = ((r * w) * (r * w)) * -0.375;
} else if (r <= -5.2e-84) {
tmp = t_0 + ((-0.25 * t_1) - 1.5);
} else if (r <= 6.6e-170) {
tmp = t_0;
} else {
tmp = t_0 + ((-0.375 * t_1) - 1.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = (r * r) * (w * w) tmp = 0 if r <= -1.95e+167: tmp = ((r * w) * (r * w)) * -0.375 elif r <= -5.2e-84: tmp = t_0 + ((-0.25 * t_1) - 1.5) elif r <= 6.6e-170: tmp = t_0 else: tmp = t_0 + ((-0.375 * t_1) - 1.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(Float64(r * r) * Float64(w * w)) tmp = 0.0 if (r <= -1.95e+167) tmp = Float64(Float64(Float64(r * w) * Float64(r * w)) * -0.375); elseif (r <= -5.2e-84) tmp = Float64(t_0 + Float64(Float64(-0.25 * t_1) - 1.5)); elseif (r <= 6.6e-170) tmp = t_0; else tmp = Float64(t_0 + Float64(Float64(-0.375 * t_1) - 1.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = (r * r) * (w * w); tmp = 0.0; if (r <= -1.95e+167) tmp = ((r * w) * (r * w)) * -0.375; elseif (r <= -5.2e-84) tmp = t_0 + ((-0.25 * t_1) - 1.5); elseif (r <= 6.6e-170) tmp = t_0; else tmp = t_0 + ((-0.375 * t_1) - 1.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(r * r), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, -1.95e+167], N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision], If[LessEqual[r, -5.2e-84], N[(t$95$0 + N[(N[(-0.25 * t$95$1), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 6.6e-170], t$95$0, N[(t$95$0 + N[(N[(-0.375 * t$95$1), $MachinePrecision] - 1.5), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \left(r \cdot r\right) \cdot \left(w \cdot w\right)\\
\mathbf{if}\;r \leq -1.95 \cdot 10^{+167}:\\
\;\;\;\;\left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot -0.375\\
\mathbf{elif}\;r \leq -5.2 \cdot 10^{-84}:\\
\;\;\;\;t_0 + \left(-0.25 \cdot t_1 - 1.5\right)\\
\mathbf{elif}\;r \leq 6.6 \cdot 10^{-170}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-0.375 \cdot t_1 - 1.5\right)\\
\end{array}
\end{array}
if r < -1.9499999999999999e167Initial program 77.0%
sub-neg77.0%
associate-/l*82.8%
cancel-sign-sub-inv82.8%
metadata-eval82.8%
*-commutative82.8%
*-commutative82.8%
metadata-eval82.8%
Simplified82.8%
Taylor expanded in v around 0 48.3%
*-commutative48.3%
*-commutative48.3%
unpow248.3%
unpow248.3%
swap-sqr90.2%
unpow290.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in r around inf 48.3%
*-commutative48.3%
unpow248.3%
unpow248.3%
swap-sqr75.1%
unpow275.1%
*-commutative75.1%
Simplified75.1%
*-commutative75.1%
pow275.1%
Applied egg-rr75.1%
if -1.9499999999999999e167 < r < -5.2e-84Initial program 93.1%
sub-neg93.1%
+-commutative93.1%
associate--l+93.1%
associate-/l*98.0%
distribute-neg-frac98.0%
associate-/r/97.9%
fma-def98.0%
sub-neg98.0%
Simplified99.8%
Taylor expanded in v around inf 95.6%
associate--l+95.6%
associate-*r/95.6%
metadata-eval95.6%
unpow295.6%
*-commutative95.6%
unpow295.6%
unpow295.6%
Simplified95.6%
if -5.2e-84 < r < 6.60000000000000007e-170Initial program 77.2%
sub-neg77.2%
associate-/l*77.2%
cancel-sign-sub-inv77.2%
metadata-eval77.2%
*-commutative77.2%
*-commutative77.2%
metadata-eval77.2%
Simplified77.2%
Taylor expanded in v around 0 77.2%
*-commutative77.2%
*-commutative77.2%
unpow277.2%
unpow277.2%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in r around 0 99.8%
unpow299.8%
Simplified99.8%
if 6.60000000000000007e-170 < r Initial program 93.4%
sub-neg93.4%
+-commutative93.4%
associate--l+93.4%
associate-/l*96.2%
distribute-neg-frac96.2%
associate-/r/96.2%
fma-def96.2%
sub-neg96.2%
Simplified86.5%
Taylor expanded in v around 0 84.9%
associate--l+84.9%
associate-*r/84.9%
metadata-eval84.9%
unpow284.9%
*-commutative84.9%
unpow284.9%
unpow284.9%
Simplified84.9%
Final simplification89.9%
(FPCore (v w r) :precision binary64 (+ -4.5 (- (+ 3.0 (/ 2.0 (* r r))) (* (* (* r w) (* r w)) 0.25))))
double code(double v, double w, double r) {
return -4.5 + ((3.0 + (2.0 / (r * r))) - (((r * w) * (r * w)) * 0.25));
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (-4.5d0) + ((3.0d0 + (2.0d0 / (r * r))) - (((r * w) * (r * w)) * 0.25d0))
end function
public static double code(double v, double w, double r) {
return -4.5 + ((3.0 + (2.0 / (r * r))) - (((r * w) * (r * w)) * 0.25));
}
def code(v, w, r): return -4.5 + ((3.0 + (2.0 / (r * r))) - (((r * w) * (r * w)) * 0.25))
function code(v, w, r) return Float64(-4.5 + Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25))) end
function tmp = code(v, w, r) tmp = -4.5 + ((3.0 + (2.0 / (r * r))) - (((r * w) * (r * w)) * 0.25)); end
code[v_, w_, r_] := N[(-4.5 + N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-4.5 + \left(\left(3 + \frac{2}{r \cdot r}\right) - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right)
\end{array}
Initial program 87.1%
sub-neg87.1%
associate-/l*90.0%
cancel-sign-sub-inv90.0%
metadata-eval90.0%
*-commutative90.0%
*-commutative90.0%
metadata-eval90.0%
Simplified90.0%
Taylor expanded in v around inf 79.8%
*-commutative79.8%
*-commutative79.8%
unpow279.8%
unpow279.8%
swap-sqr93.6%
unpow293.6%
*-commutative93.6%
Simplified93.6%
*-commutative41.9%
pow241.9%
Applied egg-rr93.6%
Final simplification93.6%
(FPCore (v w r) :precision binary64 (if (or (<= r -2.3e+94) (not (<= r 3.8e+29))) (* (* (* r w) (* r w)) -0.375) (+ (/ 2.0 (* r r)) -1.5)))
double code(double v, double w, double r) {
double tmp;
if ((r <= -2.3e+94) || !(r <= 3.8e+29)) {
tmp = ((r * w) * (r * w)) * -0.375;
} else {
tmp = (2.0 / (r * r)) + -1.5;
}
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) :: tmp
if ((r <= (-2.3d+94)) .or. (.not. (r <= 3.8d+29))) then
tmp = ((r * w) * (r * w)) * (-0.375d0)
else
tmp = (2.0d0 / (r * r)) + (-1.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if ((r <= -2.3e+94) || !(r <= 3.8e+29)) {
tmp = ((r * w) * (r * w)) * -0.375;
} else {
tmp = (2.0 / (r * r)) + -1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if (r <= -2.3e+94) or not (r <= 3.8e+29): tmp = ((r * w) * (r * w)) * -0.375 else: tmp = (2.0 / (r * r)) + -1.5 return tmp
function code(v, w, r) tmp = 0.0 if ((r <= -2.3e+94) || !(r <= 3.8e+29)) tmp = Float64(Float64(Float64(r * w) * Float64(r * w)) * -0.375); else tmp = Float64(Float64(2.0 / Float64(r * r)) + -1.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((r <= -2.3e+94) || ~((r <= 3.8e+29))) tmp = ((r * w) * (r * w)) * -0.375; else tmp = (2.0 / (r * r)) + -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[Or[LessEqual[r, -2.3e+94], N[Not[LessEqual[r, 3.8e+29]], $MachinePrecision]], N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * -0.375), $MachinePrecision], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq -2.3 \cdot 10^{+94} \lor \neg \left(r \leq 3.8 \cdot 10^{+29}\right):\\
\;\;\;\;\left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot -0.375\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r \cdot r} + -1.5\\
\end{array}
\end{array}
if r < -2.3e94 or 3.79999999999999971e29 < r Initial program 89.3%
sub-neg89.3%
associate-/l*93.4%
cancel-sign-sub-inv93.4%
metadata-eval93.4%
*-commutative93.4%
*-commutative93.4%
metadata-eval93.4%
Simplified93.4%
Taylor expanded in v around 0 72.8%
*-commutative72.8%
*-commutative72.8%
unpow272.8%
unpow272.8%
swap-sqr92.2%
unpow292.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in r around inf 62.5%
*-commutative62.5%
unpow262.5%
unpow262.5%
swap-sqr73.5%
unpow273.5%
*-commutative73.5%
Simplified73.5%
*-commutative73.5%
pow273.5%
Applied egg-rr73.5%
if -2.3e94 < r < 3.79999999999999971e29Initial program 85.4%
sub-neg85.4%
+-commutative85.4%
associate--l+85.4%
associate-/l*87.3%
distribute-neg-frac87.3%
associate-/r/87.3%
fma-def87.3%
sub-neg87.3%
Simplified88.1%
Taylor expanded in r around 0 80.7%
sub-neg80.7%
associate-*r/80.7%
metadata-eval80.7%
unpow280.7%
metadata-eval80.7%
Simplified80.7%
Final simplification77.5%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) -1.5))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + -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 = (2.0d0 / (r * r)) + (-1.5d0)
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + -1.5;
}
def code(v, w, r): return (2.0 / (r * r)) + -1.5
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + -1.5) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + -1.5; end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + -1.5
\end{array}
Initial program 87.1%
sub-neg87.1%
+-commutative87.1%
associate--l+87.1%
associate-/l*90.0%
distribute-neg-frac90.0%
associate-/r/90.0%
fma-def90.0%
sub-neg90.0%
Simplified82.3%
Taylor expanded in r around 0 55.0%
sub-neg55.0%
associate-*r/55.0%
metadata-eval55.0%
unpow255.0%
metadata-eval55.0%
Simplified55.0%
Final simplification55.0%
(FPCore (v w r) :precision binary64 (/ 2.0 (* r r)))
double code(double v, double w, double r) {
return 2.0 / (r * r);
}
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)
end function
public static double code(double v, double w, double r) {
return 2.0 / (r * r);
}
def code(v, w, r): return 2.0 / (r * r)
function code(v, w, r) return Float64(2.0 / Float64(r * r)) end
function tmp = code(v, w, r) tmp = 2.0 / (r * r); end
code[v_, w_, r_] := N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r}
\end{array}
Initial program 87.1%
sub-neg87.1%
associate-/l*90.0%
cancel-sign-sub-inv90.0%
metadata-eval90.0%
*-commutative90.0%
*-commutative90.0%
metadata-eval90.0%
Simplified90.0%
Taylor expanded in v around 0 79.5%
*-commutative79.5%
*-commutative79.5%
unpow279.5%
unpow279.5%
swap-sqr94.3%
unpow294.3%
*-commutative94.3%
Simplified94.3%
Taylor expanded in r around 0 40.4%
unpow240.4%
Simplified40.4%
Final simplification40.4%
herbie shell --seed 2023181
(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))