
(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 9 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
(+
(/ 2.0 (* r r))
(+
-1.5
(/
(- -0.375 (* v -0.25))
(* (/ (* (pow w -1.0) (/ 1.0 r)) (* r w)) (- 1.0 v))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((-0.375 - (v * -0.25)) / (((pow(w, -1.0) * (1.0 / r)) / (r * w)) * (1.0 - v))));
}
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) - (v * (-0.25d0))) / ((((w ** (-1.0d0)) * (1.0d0 / r)) / (r * w)) * (1.0d0 - v))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((-0.375 - (v * -0.25)) / (((Math.pow(w, -1.0) * (1.0 / r)) / (r * w)) * (1.0 - v))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + ((-0.375 - (v * -0.25)) / (((math.pow(w, -1.0) * (1.0 / r)) / (r * w)) * (1.0 - v))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(-0.375 - Float64(v * -0.25)) / Float64(Float64(Float64((w ^ -1.0) * Float64(1.0 / r)) / Float64(r * w)) * Float64(1.0 - v))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + ((-0.375 - (v * -0.25)) / ((((w ^ -1.0) * (1.0 / r)) / (r * w)) * (1.0 - v)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(-0.375 - N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[Power[w, -1.0], $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{-0.375 - v \cdot -0.25}{\frac{{w}^{-1} \cdot \frac{1}{r}}{r \cdot w} \cdot \left(1 - v\right)}\right)
\end{array}
Initial program 87.8%
Simplified89.0%
fma-undefine89.0%
*-commutative89.0%
+-commutative89.0%
associate-*r/89.4%
*-commutative89.4%
associate-/l*89.1%
clear-num89.1%
un-div-inv89.1%
distribute-rgt-in89.1%
metadata-eval89.1%
*-commutative89.1%
associate-*l*89.1%
metadata-eval89.1%
associate-*r*78.6%
pow278.6%
pow278.6%
pow-prod-down99.5%
*-commutative99.5%
Applied egg-rr99.5%
frac-2neg99.5%
div-inv99.5%
+-commutative99.5%
fma-define99.5%
div-inv99.5%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
neg-sub099.8%
fma-undefine99.8%
*-commutative99.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
*-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
Simplified99.8%
*-commutative99.8%
metadata-eval99.8%
pow-sqr99.7%
unpow-199.7%
*-commutative99.7%
unpow-199.7%
*-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
inv-pow99.8%
*-commutative99.8%
unpow-prod-down99.8%
inv-pow99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (- -0.375 (* v -0.25)) (* (pow (* r w) -2.0) (- 1.0 v))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((-0.375 - (v * -0.25)) / (pow((r * w), -2.0) * (1.0 - v))));
}
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) - (v * (-0.25d0))) / (((r * w) ** (-2.0d0)) * (1.0d0 - v))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((-0.375 - (v * -0.25)) / (Math.pow((r * w), -2.0) * (1.0 - v))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + ((-0.375 - (v * -0.25)) / (math.pow((r * w), -2.0) * (1.0 - v))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(-0.375 - Float64(v * -0.25)) / Float64((Float64(r * w) ^ -2.0) * Float64(1.0 - v))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + ((-0.375 - (v * -0.25)) / (((r * w) ^ -2.0) * (1.0 - v)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(-0.375 - N[(v * -0.25), $MachinePrecision]), $MachinePrecision] / N[(N[Power[N[(r * w), $MachinePrecision], -2.0], $MachinePrecision] * N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{-0.375 - v \cdot -0.25}{{\left(r \cdot w\right)}^{-2} \cdot \left(1 - v\right)}\right)
\end{array}
Initial program 87.8%
Simplified89.0%
fma-undefine89.0%
*-commutative89.0%
+-commutative89.0%
associate-*r/89.4%
*-commutative89.4%
associate-/l*89.1%
clear-num89.1%
un-div-inv89.1%
distribute-rgt-in89.1%
metadata-eval89.1%
*-commutative89.1%
associate-*l*89.1%
metadata-eval89.1%
associate-*r*78.6%
pow278.6%
pow278.6%
pow-prod-down99.5%
*-commutative99.5%
Applied egg-rr99.5%
frac-2neg99.5%
div-inv99.5%
+-commutative99.5%
fma-define99.5%
div-inv99.5%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
neg-sub099.8%
fma-undefine99.8%
*-commutative99.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
*-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(if (<= v 20000000000.0)
(+
(/ 2.0 (* r r))
(+ -1.5 (/ (+ (* v -0.25) 0.375) (* (/ 1.0 (* r w)) (/ -1.0 (* r w))))))
(- (+ 3.0 (/ (/ 2.0 r) r)) 4.5)))
double code(double v, double w, double r) {
double tmp;
if (v <= 20000000000.0) {
tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((1.0 / (r * w)) * (-1.0 / (r * w)))));
} else {
tmp = (3.0 + ((2.0 / r) / r)) - 4.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 (v <= 20000000000.0d0) then
tmp = (2.0d0 / (r * r)) + ((-1.5d0) + (((v * (-0.25d0)) + 0.375d0) / ((1.0d0 / (r * w)) * ((-1.0d0) / (r * w)))))
else
tmp = (3.0d0 + ((2.0d0 / r) / r)) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (v <= 20000000000.0) {
tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((1.0 / (r * w)) * (-1.0 / (r * w)))));
} else {
tmp = (3.0 + ((2.0 / r) / r)) - 4.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if v <= 20000000000.0: tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((1.0 / (r * w)) * (-1.0 / (r * w))))) else: tmp = (3.0 + ((2.0 / r) / r)) - 4.5 return tmp
function code(v, w, r) tmp = 0.0 if (v <= 20000000000.0) tmp = Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) + 0.375) / Float64(Float64(1.0 / Float64(r * w)) * Float64(-1.0 / Float64(r * w)))))); else tmp = Float64(Float64(3.0 + Float64(Float64(2.0 / r) / r)) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (v <= 20000000000.0) tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((1.0 / (r * w)) * (-1.0 / (r * w))))); else tmp = (3.0 + ((2.0 / r) / r)) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[v, 20000000000.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] / N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 20000000000:\\
\;\;\;\;\frac{2}{r \cdot r} + \left(-1.5 + \frac{v \cdot -0.25 + 0.375}{\frac{1}{r \cdot w} \cdot \frac{-1}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5\\
\end{array}
\end{array}
if v < 2e10Initial program 90.7%
Simplified92.0%
fma-undefine92.0%
*-commutative92.0%
+-commutative92.0%
associate-*r/92.1%
*-commutative92.1%
associate-/l*91.7%
clear-num91.7%
un-div-inv91.7%
distribute-rgt-in91.7%
metadata-eval91.7%
*-commutative91.7%
associate-*l*91.7%
metadata-eval91.7%
associate-*r*79.2%
pow279.2%
pow279.2%
pow-prod-down99.4%
*-commutative99.4%
Applied egg-rr99.4%
unpow299.4%
Applied egg-rr99.4%
associate-/r*99.8%
div-inv99.7%
*-commutative99.7%
*-commutative99.7%
Applied egg-rr99.7%
Taylor expanded in v around 0 92.9%
if 2e10 < v Initial program 79.1%
Simplified75.3%
Taylor expanded in r around 0 63.1%
associate-/r*63.1%
div-inv63.0%
Applied egg-rr63.0%
associate-*r/63.1%
*-rgt-identity63.1%
Simplified63.1%
Final simplification85.5%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (/ (- (* v -0.25) -0.375) (* (/ (/ 1.0 (* r w)) (* r w)) (- 1.0 v))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) - -0.375) / (((1.0 / (r * w)) / (r * w)) * (1.0 - v))));
}
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) - (((v * (-0.25d0)) - (-0.375d0)) / (((1.0d0 / (r * w)) / (r * w)) * (1.0d0 - v))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) - -0.375) / (((1.0 / (r * w)) / (r * w)) * (1.0 - v))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) - -0.375) / (((1.0 / (r * w)) / (r * w)) * (1.0 - v))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(Float64(v * -0.25) - -0.375) / Float64(Float64(Float64(1.0 / Float64(r * w)) / Float64(r * w)) * Float64(1.0 - v))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (((v * -0.25) - -0.375) / (((1.0 / (r * w)) / (r * w)) * (1.0 - v)))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(N[(v * -0.25), $MachinePrecision] - -0.375), $MachinePrecision] / N[(N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - \frac{v \cdot -0.25 - -0.375}{\frac{\frac{1}{r \cdot w}}{r \cdot w} \cdot \left(1 - v\right)}\right)
\end{array}
Initial program 87.8%
Simplified89.0%
fma-undefine89.0%
*-commutative89.0%
+-commutative89.0%
associate-*r/89.4%
*-commutative89.4%
associate-/l*89.1%
clear-num89.1%
un-div-inv89.1%
distribute-rgt-in89.1%
metadata-eval89.1%
*-commutative89.1%
associate-*l*89.1%
metadata-eval89.1%
associate-*r*78.6%
pow278.6%
pow278.6%
pow-prod-down99.5%
*-commutative99.5%
Applied egg-rr99.5%
frac-2neg99.5%
div-inv99.5%
+-commutative99.5%
fma-define99.5%
div-inv99.5%
pow-flip99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
neg-sub099.8%
fma-undefine99.8%
*-commutative99.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
*-commutative99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
Simplified99.8%
*-commutative99.8%
metadata-eval99.8%
pow-sqr99.7%
unpow-199.7%
*-commutative99.7%
unpow-199.7%
*-commutative99.7%
Applied egg-rr99.7%
associate-*l/99.8%
*-lft-identity99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (+ (* v -0.25) 0.375) (* (/ 1.0 (* r w)) (/ (+ v -1.0) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((1.0 / (r * w)) * ((v + -1.0) / (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) + (((v * (-0.25d0)) + 0.375d0) / ((1.0d0 / (r * w)) * ((v + (-1.0d0)) / (r * w)))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((1.0 / (r * w)) * ((v + -1.0) / (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((1.0 / (r * w)) * ((v + -1.0) / (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) + 0.375) / Float64(Float64(1.0 / Float64(r * w)) * Float64(Float64(v + -1.0) / Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + (((v * -0.25) + 0.375) / ((1.0 / (r * w)) * ((v + -1.0) / (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] / N[(N[(1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(N[(v + -1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{v \cdot -0.25 + 0.375}{\frac{1}{r \cdot w} \cdot \frac{v + -1}{r \cdot w}}\right)
\end{array}
Initial program 87.8%
Simplified89.0%
fma-undefine89.0%
*-commutative89.0%
+-commutative89.0%
associate-*r/89.4%
*-commutative89.4%
associate-/l*89.1%
clear-num89.1%
un-div-inv89.1%
distribute-rgt-in89.1%
metadata-eval89.1%
*-commutative89.1%
associate-*l*89.1%
metadata-eval89.1%
associate-*r*78.6%
pow278.6%
pow278.6%
pow-prod-down99.5%
*-commutative99.5%
Applied egg-rr99.5%
*-un-lft-identity99.5%
unpow299.5%
times-frac99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (- -1.5 (/ (+ (* v -0.25) 0.375) (/ (- 1.0 v) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((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) - (((v * (-0.25d0)) + 0.375d0) / ((1.0d0 - v) / ((r * w) * (r * w)))))
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((r * w) * (r * w)))))
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + Float64(-1.5 - Float64(Float64(Float64(v * -0.25) + 0.375) / Float64(Float64(1.0 - v) / Float64(Float64(r * w) * Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 - (((v * -0.25) + 0.375) / ((1.0 - v) / ((r * w) * (r * w))))); end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(N[(v * -0.25), $MachinePrecision] + 0.375), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 - \frac{v \cdot -0.25 + 0.375}{\frac{1 - v}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 87.8%
Simplified89.0%
fma-undefine89.0%
*-commutative89.0%
+-commutative89.0%
associate-*r/89.4%
*-commutative89.4%
associate-/l*89.1%
clear-num89.1%
un-div-inv89.1%
distribute-rgt-in89.1%
metadata-eval89.1%
*-commutative89.1%
associate-*l*89.1%
metadata-eval89.1%
associate-*r*78.6%
pow278.6%
pow278.6%
pow-prod-down99.5%
*-commutative99.5%
Applied egg-rr99.5%
unpow299.5%
Applied egg-rr99.5%
Final simplification99.5%
(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(Float64(2.0 / 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[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{\frac{2}{r}}{r}\right) - 4.5
\end{array}
Initial program 87.8%
Simplified77.3%
Taylor expanded in r around 0 60.0%
associate-/r*60.0%
div-inv60.0%
Applied egg-rr60.0%
associate-*r/60.0%
*-rgt-identity60.0%
Simplified60.0%
(FPCore (v w r) :precision binary64 (- (+ (/ 2.0 (* r r)) 3.0) 4.5))
double code(double v, double w, double r) {
return ((2.0 / (r * r)) + 3.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 = ((2.0d0 / (r * r)) + 3.0d0) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((2.0 / (r * r)) + 3.0) - 4.5;
}
def code(v, w, r): return ((2.0 / (r * r)) + 3.0) - 4.5
function code(v, w, r) return Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - 4.5) end
function tmp = code(v, w, r) tmp = ((2.0 / (r * r)) + 3.0) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{2}{r \cdot r} + 3\right) - 4.5
\end{array}
Initial program 87.8%
Simplified77.3%
Taylor expanded in r around 0 60.0%
Final simplification60.0%
(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.8%
Simplified77.3%
Taylor expanded in r around 0 60.0%
Taylor expanded in r around inf 18.5%
herbie shell --seed 2024103
(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))