
(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 5 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 (<= (* w w) 1e+70)
(+
(+ t_0 (* (/ (+ -0.375 (* v 0.25)) (- 1.0 v)) (* r (* w (* w r)))))
-1.5)
(+
t_0
(+ -1.5 (* w (* (* w r) (* r (/ (fma v 0.25 -0.375) (- 1.0 v))))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((w * w) <= 1e+70) {
tmp = (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (w * (w * r))))) + -1.5;
} else {
tmp = t_0 + (-1.5 + (w * ((w * r) * (r * (fma(v, 0.25, -0.375) / (1.0 - v))))));
}
return tmp;
}
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(w * w) <= 1e+70) tmp = Float64(Float64(t_0 + Float64(Float64(Float64(-0.375 + Float64(v * 0.25)) / Float64(1.0 - v)) * Float64(r * Float64(w * Float64(w * r))))) + -1.5); else tmp = Float64(t_0 + Float64(-1.5 + Float64(w * Float64(Float64(w * r) * Float64(r * Float64(fma(v, 0.25, -0.375) / Float64(1.0 - v))))))); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(w * w), $MachinePrecision], 1e+70], N[(N[(t$95$0 + N[(N[(N[(-0.375 + N[(v * 0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(r * N[(w * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(w * N[(N[(w * r), $MachinePrecision] * N[(r * N[(N[(v * 0.25 + -0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \cdot w \leq 10^{+70}:\\
\;\;\;\;\left(t_0 + \frac{-0.375 + v \cdot 0.25}{1 - v} \cdot \left(r \cdot \left(w \cdot \left(w \cdot r\right)\right)\right)\right) + -1.5\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 + w \cdot \left(\left(w \cdot r\right) \cdot \left(r \cdot \frac{\mathsf{fma}\left(v, 0.25, -0.375\right)}{1 - v}\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 w w) < 1.00000000000000007e70Initial program 89.1%
Simplified94.2%
add-sqr-sqrt75.9%
pow275.9%
*-commutative75.9%
sqrt-prod50.0%
sqrt-prod23.5%
add-sqr-sqrt51.2%
Applied egg-rr51.2%
unpow251.2%
*-commutative51.2%
associate-*r*51.2%
associate-*r*51.2%
add-sqr-sqrt99.7%
*-commutative99.7%
Applied egg-rr99.7%
if 1.00000000000000007e70 < (*.f64 w w) Initial program 74.5%
Simplified76.2%
associate-/r*76.3%
associate-/r/76.3%
*-commutative76.3%
associate-*l/76.3%
+-commutative76.3%
associate-*r*92.8%
associate-*r*99.9%
+-commutative99.9%
*-commutative99.9%
fma-def99.9%
Applied egg-rr99.9%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(if (<= r 2e-30)
(+ -1.5 (+ (* 2.0 (pow r -2.0)) (* -0.25 (* (* w r) (* w r)))))
(+
(+
(/ 2.0 (* r r))
(* (/ (+ -0.375 (* v 0.25)) (- 1.0 v)) (* r (* w (* w r)))))
-1.5)))
double code(double v, double w, double r) {
double tmp;
if (r <= 2e-30) {
tmp = -1.5 + ((2.0 * pow(r, -2.0)) + (-0.25 * ((w * r) * (w * r))));
} else {
tmp = ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (w * (w * 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 <= 2d-30) then
tmp = (-1.5d0) + ((2.0d0 * (r ** (-2.0d0))) + ((-0.25d0) * ((w * r) * (w * r))))
else
tmp = ((2.0d0 / (r * r)) + ((((-0.375d0) + (v * 0.25d0)) / (1.0d0 - v)) * (r * (w * (w * r))))) + (-1.5d0)
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 2e-30) {
tmp = -1.5 + ((2.0 * Math.pow(r, -2.0)) + (-0.25 * ((w * r) * (w * r))));
} else {
tmp = ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (w * (w * r))))) + -1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 2e-30: tmp = -1.5 + ((2.0 * math.pow(r, -2.0)) + (-0.25 * ((w * r) * (w * r)))) else: tmp = ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (w * (w * r))))) + -1.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 2e-30) tmp = Float64(-1.5 + Float64(Float64(2.0 * (r ^ -2.0)) + Float64(-0.25 * Float64(Float64(w * r) * Float64(w * r))))); else tmp = Float64(Float64(Float64(2.0 / Float64(r * r)) + Float64(Float64(Float64(-0.375 + Float64(v * 0.25)) / Float64(1.0 - v)) * Float64(r * Float64(w * Float64(w * r))))) + -1.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 2e-30) tmp = -1.5 + ((2.0 * (r ^ -2.0)) + (-0.25 * ((w * r) * (w * r)))); else tmp = ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (w * (w * r))))) + -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 2e-30], N[(-1.5 + N[(N[(2.0 * N[Power[r, -2.0], $MachinePrecision]), $MachinePrecision] + N[(-0.25 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.375 + N[(v * 0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(r * N[(w * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 2 \cdot 10^{-30}:\\
\;\;\;\;-1.5 + \left(2 \cdot {r}^{-2} + -0.25 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{2}{r \cdot r} + \frac{-0.375 + v \cdot 0.25}{1 - v} \cdot \left(r \cdot \left(w \cdot \left(w \cdot r\right)\right)\right)\right) + -1.5\\
\end{array}
\end{array}
if r < 2e-30Initial program 80.4%
Simplified82.9%
Taylor expanded in v around inf 77.4%
unpow277.4%
unpow277.4%
swap-sqr96.4%
unpow296.4%
Simplified96.4%
unpow296.4%
Applied egg-rr96.4%
div-inv96.4%
*-commutative96.4%
pow296.4%
pow-flip96.5%
metadata-eval96.5%
Applied egg-rr96.5%
if 2e-30 < r Initial program 90.0%
Simplified97.1%
add-sqr-sqrt97.0%
pow297.0%
*-commutative97.0%
sqrt-prod97.0%
sqrt-prod50.6%
add-sqr-sqrt99.7%
Applied egg-rr99.7%
unpow299.7%
*-commutative99.7%
associate-*r*99.7%
associate-*r*99.8%
add-sqr-sqrt99.8%
*-commutative99.8%
Applied egg-rr99.8%
Final simplification97.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= w 5e+169)
(+
(+ t_0 (* (/ (+ -0.375 (* v 0.25)) (- 1.0 v)) (* r (* w (* w r)))))
-1.5)
(+ -1.5 (+ t_0 (* -0.25 (* (* w r) (* w r))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (w <= 5e+169) {
tmp = (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (w * (w * r))))) + -1.5;
} else {
tmp = -1.5 + (t_0 + (-0.25 * ((w * r) * (w * 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 (w <= 5d+169) then
tmp = (t_0 + ((((-0.375d0) + (v * 0.25d0)) / (1.0d0 - v)) * (r * (w * (w * r))))) + (-1.5d0)
else
tmp = (-1.5d0) + (t_0 + ((-0.25d0) * ((w * r) * (w * 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 (w <= 5e+169) {
tmp = (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (w * (w * r))))) + -1.5;
} else {
tmp = -1.5 + (t_0 + (-0.25 * ((w * r) * (w * r))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if w <= 5e+169: tmp = (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (w * (w * r))))) + -1.5 else: tmp = -1.5 + (t_0 + (-0.25 * ((w * r) * (w * r)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (w <= 5e+169) tmp = Float64(Float64(t_0 + Float64(Float64(Float64(-0.375 + Float64(v * 0.25)) / Float64(1.0 - v)) * Float64(r * Float64(w * Float64(w * r))))) + -1.5); else tmp = Float64(-1.5 + Float64(t_0 + Float64(-0.25 * Float64(Float64(w * r) * Float64(w * r))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (w <= 5e+169) tmp = (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (r * (w * (w * r))))) + -1.5; else tmp = -1.5 + (t_0 + (-0.25 * ((w * r) * (w * r)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, 5e+169], N[(N[(t$95$0 + N[(N[(N[(-0.375 + N[(v * 0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(r * N[(w * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision], N[(-1.5 + N[(t$95$0 + N[(-0.25 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w \leq 5 \cdot 10^{+169}:\\
\;\;\;\;\left(t_0 + \frac{-0.375 + v \cdot 0.25}{1 - v} \cdot \left(r \cdot \left(w \cdot \left(w \cdot r\right)\right)\right)\right) + -1.5\\
\mathbf{else}:\\
\;\;\;\;-1.5 + \left(t_0 + -0.25 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)\right)\\
\end{array}
\end{array}
if w < 5.00000000000000017e169Initial program 86.5%
Simplified90.6%
add-sqr-sqrt62.9%
pow262.9%
*-commutative62.9%
sqrt-prod46.1%
sqrt-prod20.5%
add-sqr-sqrt50.3%
Applied egg-rr50.3%
unpow250.3%
*-commutative50.3%
associate-*r*50.3%
associate-*r*50.4%
add-sqr-sqrt98.1%
*-commutative98.1%
Applied egg-rr98.1%
if 5.00000000000000017e169 < w Initial program 54.1%
Simplified54.1%
Taylor expanded in v around inf 54.1%
unpow254.1%
unpow254.1%
swap-sqr99.9%
unpow299.9%
Simplified99.9%
unpow299.9%
Applied egg-rr99.9%
Final simplification98.3%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (or (<= v -1.4e+22) (not (<= v 1.65e-62)))
(+ -1.5 (+ t_0 (* -0.25 (* (* w r) (* w r)))))
(+ t_0 (+ -1.5 (* (* w r) (* r (* w -0.375))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((v <= -1.4e+22) || !(v <= 1.65e-62)) {
tmp = -1.5 + (t_0 + (-0.25 * ((w * r) * (w * r))));
} else {
tmp = t_0 + (-1.5 + ((w * r) * (r * (w * -0.375))));
}
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 <= (-1.4d+22)) .or. (.not. (v <= 1.65d-62))) then
tmp = (-1.5d0) + (t_0 + ((-0.25d0) * ((w * r) * (w * r))))
else
tmp = t_0 + ((-1.5d0) + ((w * r) * (r * (w * (-0.375d0)))))
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 <= -1.4e+22) || !(v <= 1.65e-62)) {
tmp = -1.5 + (t_0 + (-0.25 * ((w * r) * (w * r))));
} else {
tmp = t_0 + (-1.5 + ((w * r) * (r * (w * -0.375))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if (v <= -1.4e+22) or not (v <= 1.65e-62): tmp = -1.5 + (t_0 + (-0.25 * ((w * r) * (w * r)))) else: tmp = t_0 + (-1.5 + ((w * r) * (r * (w * -0.375)))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if ((v <= -1.4e+22) || !(v <= 1.65e-62)) tmp = Float64(-1.5 + Float64(t_0 + Float64(-0.25 * Float64(Float64(w * r) * Float64(w * r))))); else tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(w * r) * Float64(r * Float64(w * -0.375))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((v <= -1.4e+22) || ~((v <= 1.65e-62))) tmp = -1.5 + (t_0 + (-0.25 * ((w * r) * (w * r)))); else tmp = t_0 + (-1.5 + ((w * r) * (r * (w * -0.375)))); 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, -1.4e+22], N[Not[LessEqual[v, 1.65e-62]], $MachinePrecision]], N[(-1.5 + N[(t$95$0 + N[(-0.25 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(-1.5 + N[(N[(w * r), $MachinePrecision] * N[(r * N[(w * -0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -1.4 \cdot 10^{+22} \lor \neg \left(v \leq 1.65 \cdot 10^{-62}\right):\\
\;\;\;\;-1.5 + \left(t_0 + -0.25 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 + \left(-1.5 + \left(w \cdot r\right) \cdot \left(r \cdot \left(w \cdot -0.375\right)\right)\right)\\
\end{array}
\end{array}
if v < -1.4e22 or 1.65000000000000002e-62 < v Initial program 79.0%
Simplified85.6%
Taylor expanded in v around inf 77.8%
unpow277.8%
unpow277.8%
swap-sqr99.7%
unpow299.7%
Simplified99.7%
unpow299.7%
Applied egg-rr99.7%
if -1.4e22 < v < 1.65000000000000002e-62Initial program 87.9%
Simplified87.8%
Taylor expanded in v around 0 87.8%
*-commutative87.8%
Simplified87.8%
*-un-lft-identity87.8%
div-inv87.8%
frac-times98.2%
*-commutative98.2%
times-frac99.8%
clear-num99.8%
div-inv99.8%
clear-num99.8%
/-rgt-identity99.8%
*-commutative99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
*-commutative99.8%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ -1.5 (+ (/ 2.0 (* r r)) (* -0.25 (* (* w r) (* w r))))))
double code(double v, double w, double r) {
return -1.5 + ((2.0 / (r * r)) + (-0.25 * ((w * r) * (w * r))));
}
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) + ((2.0d0 / (r * r)) + ((-0.25d0) * ((w * r) * (w * r))))
end function
public static double code(double v, double w, double r) {
return -1.5 + ((2.0 / (r * r)) + (-0.25 * ((w * r) * (w * r))));
}
def code(v, w, r): return -1.5 + ((2.0 / (r * r)) + (-0.25 * ((w * r) * (w * r))))
function code(v, w, r) return Float64(-1.5 + Float64(Float64(2.0 / Float64(r * r)) + Float64(-0.25 * Float64(Float64(w * r) * Float64(w * r))))) end
function tmp = code(v, w, r) tmp = -1.5 + ((2.0 / (r * r)) + (-0.25 * ((w * r) * (w * r)))); end
code[v_, w_, r_] := N[(-1.5 + N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-0.25 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \left(\frac{2}{r \cdot r} + -0.25 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)\right)
\end{array}
Initial program 82.9%
Simplified86.6%
Taylor expanded in v around inf 79.0%
unpow279.0%
unpow279.0%
swap-sqr96.1%
unpow296.1%
Simplified96.1%
unpow296.1%
Applied egg-rr96.1%
Final simplification96.1%
herbie shell --seed 2023301
(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))