
(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 (+ (/ (/ 2.0 r) r) (+ -1.5 (/ (- (* v -0.25) -0.375) (/ (+ v -1.0) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return ((2.0 / r) / r) + (-1.5 + (((v * -0.25) - -0.375) / ((v + -1.0) / ((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)) / ((v + (-1.0d0)) / ((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) / ((v + -1.0) / ((r * w) * (r * w)))));
}
def code(v, w, r): return ((2.0 / r) / r) + (-1.5 + (((v * -0.25) - -0.375) / ((v + -1.0) / ((r * w) * (r * w)))))
function code(v, w, r) return Float64(Float64(Float64(2.0 / r) / r) + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) - -0.375) / Float64(Float64(v + -1.0) / 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) / ((v + -1.0) / ((r * w) * (r * w))))); end
code[v_, w_, r_] := N[(N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] - -0.375), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{r}}{r} + \left(-1.5 + \frac{v \cdot -0.25 - -0.375}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 87.8%
Simplified97.6%
frac-2neg97.6%
*-commutative97.6%
associate-*r*89.0%
div-inv88.9%
associate-*r*97.6%
*-commutative97.6%
associate-*r*99.8%
pow299.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
neg-sub099.8%
fma-udef99.8%
*-commutative99.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
*-commutative99.8%
distribute-neg-frac99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
*-commutative99.8%
Simplified99.8%
unpow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (- -1.5 (* (* (* r w) (* r w)) 0.25))) (t_1 (/ (/ 2.0 r) r)))
(if (<= v -27000000.0)
(+ t_0 (/ -2.0 (* r (- r))))
(if (<= v 8.6e-91)
(+ t_1 (+ -1.5 (/ (- (* v -0.25) -0.375) (/ (/ -1.0 (* r w)) (* r w)))))
(+ t_1 t_0)))))
double code(double v, double w, double r) {
double t_0 = -1.5 - (((r * w) * (r * w)) * 0.25);
double t_1 = (2.0 / r) / r;
double tmp;
if (v <= -27000000.0) {
tmp = t_0 + (-2.0 / (r * -r));
} else if (v <= 8.6e-91) {
tmp = t_1 + (-1.5 + (((v * -0.25) - -0.375) / ((-1.0 / (r * w)) / (r * w))));
} else {
tmp = t_1 + 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 = (-1.5d0) - (((r * w) * (r * w)) * 0.25d0)
t_1 = (2.0d0 / r) / r
if (v <= (-27000000.0d0)) then
tmp = t_0 + ((-2.0d0) / (r * -r))
else if (v <= 8.6d-91) then
tmp = t_1 + ((-1.5d0) + (((v * (-0.25d0)) - (-0.375d0)) / (((-1.0d0) / (r * w)) / (r * w))))
else
tmp = t_1 + t_0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = -1.5 - (((r * w) * (r * w)) * 0.25);
double t_1 = (2.0 / r) / r;
double tmp;
if (v <= -27000000.0) {
tmp = t_0 + (-2.0 / (r * -r));
} else if (v <= 8.6e-91) {
tmp = t_1 + (-1.5 + (((v * -0.25) - -0.375) / ((-1.0 / (r * w)) / (r * w))));
} else {
tmp = t_1 + t_0;
}
return tmp;
}
def code(v, w, r): t_0 = -1.5 - (((r * w) * (r * w)) * 0.25) t_1 = (2.0 / r) / r tmp = 0 if v <= -27000000.0: tmp = t_0 + (-2.0 / (r * -r)) elif v <= 8.6e-91: tmp = t_1 + (-1.5 + (((v * -0.25) - -0.375) / ((-1.0 / (r * w)) / (r * w)))) else: tmp = t_1 + t_0 return tmp
function code(v, w, r) t_0 = Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25)) t_1 = Float64(Float64(2.0 / r) / r) tmp = 0.0 if (v <= -27000000.0) tmp = Float64(t_0 + Float64(-2.0 / Float64(r * Float64(-r)))); elseif (v <= 8.6e-91) tmp = Float64(t_1 + Float64(-1.5 + Float64(Float64(Float64(v * -0.25) - -0.375) / Float64(Float64(-1.0 / Float64(r * w)) / Float64(r * w))))); else tmp = Float64(t_1 + t_0); end return tmp end
function tmp_2 = code(v, w, r) t_0 = -1.5 - (((r * w) * (r * w)) * 0.25); t_1 = (2.0 / r) / r; tmp = 0.0; if (v <= -27000000.0) tmp = t_0 + (-2.0 / (r * -r)); elseif (v <= 8.6e-91) tmp = t_1 + (-1.5 + (((v * -0.25) - -0.375) / ((-1.0 / (r * w)) / (r * w)))); else tmp = t_1 + t_0; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]}, If[LessEqual[v, -27000000.0], N[(t$95$0 + N[(-2.0 / N[(r * (-r)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 8.6e-91], N[(t$95$1 + N[(-1.5 + N[(N[(N[(v * -0.25), $MachinePrecision] - -0.375), $MachinePrecision] / N[(N[(-1.0 / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\\
t_1 := \frac{\frac{2}{r}}{r}\\
\mathbf{if}\;v \leq -27000000:\\
\;\;\;\;t\_0 + \frac{-2}{r \cdot \left(-r\right)}\\
\mathbf{elif}\;v \leq 8.6 \cdot 10^{-91}:\\
\;\;\;\;t\_1 + \left(-1.5 + \frac{v \cdot -0.25 - -0.375}{\frac{\frac{-1}{r \cdot w}}{r \cdot w}}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + t\_0\\
\end{array}
\end{array}
if v < -2.7e7Initial program 91.7%
Simplified98.4%
Taylor expanded in v around inf 86.2%
*-commutative86.2%
*-commutative86.2%
unpow286.2%
unpow286.2%
swap-sqr99.6%
unpow299.6%
*-commutative99.6%
Simplified99.6%
unpow299.8%
Applied egg-rr99.6%
div-inv99.6%
Applied egg-rr99.6%
frac-2neg99.6%
metadata-eval99.6%
frac-times99.6%
metadata-eval99.6%
Applied egg-rr99.6%
if -2.7e7 < v < 8.6e-91Initial program 86.5%
Simplified98.9%
frac-2neg98.9%
*-commutative98.9%
associate-*r*86.5%
div-inv86.5%
associate-*r*98.9%
*-commutative98.9%
associate-*r*99.8%
pow299.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
neg-sub099.8%
fma-udef99.8%
*-commutative99.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
*-commutative99.8%
distribute-neg-frac99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
*-commutative99.8%
Simplified99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in v around 0 99.0%
if 8.6e-91 < v Initial program 86.9%
Simplified95.4%
Taylor expanded in v around inf 81.4%
*-commutative81.4%
*-commutative81.4%
unpow281.4%
unpow281.4%
swap-sqr98.4%
unpow298.4%
*-commutative98.4%
Simplified98.4%
unpow299.8%
Applied egg-rr98.4%
Final simplification98.9%
(FPCore (v w r)
:precision binary64
(if (<= w 4.3e+176)
(+
(/ (/ 2.0 r) r)
(+ -1.5 (* (* w (* r w)) (/ (- (* v -0.25) -0.375) (/ (+ v -1.0) r)))))
(+ (* (/ 2.0 r) (/ 1.0 r)) (- -1.5 (* (* (* r w) (* r w)) 0.25)))))
double code(double v, double w, double r) {
double tmp;
if (w <= 4.3e+176) {
tmp = ((2.0 / r) / r) + (-1.5 + ((w * (r * w)) * (((v * -0.25) - -0.375) / ((v + -1.0) / r))));
} else {
tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (((r * w) * (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 <= 4.3d+176) then
tmp = ((2.0d0 / r) / r) + ((-1.5d0) + ((w * (r * w)) * (((v * (-0.25d0)) - (-0.375d0)) / ((v + (-1.0d0)) / r))))
else
tmp = ((2.0d0 / r) * (1.0d0 / r)) + ((-1.5d0) - (((r * w) * (r * w)) * 0.25d0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (w <= 4.3e+176) {
tmp = ((2.0 / r) / r) + (-1.5 + ((w * (r * w)) * (((v * -0.25) - -0.375) / ((v + -1.0) / r))));
} else {
tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (((r * w) * (r * w)) * 0.25));
}
return tmp;
}
def code(v, w, r): tmp = 0 if w <= 4.3e+176: tmp = ((2.0 / r) / r) + (-1.5 + ((w * (r * w)) * (((v * -0.25) - -0.375) / ((v + -1.0) / r)))) else: tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (((r * w) * (r * w)) * 0.25)) return tmp
function code(v, w, r) tmp = 0.0 if (w <= 4.3e+176) tmp = Float64(Float64(Float64(2.0 / r) / r) + Float64(-1.5 + Float64(Float64(w * Float64(r * w)) * Float64(Float64(Float64(v * -0.25) - -0.375) / Float64(Float64(v + -1.0) / r))))); else tmp = Float64(Float64(Float64(2.0 / r) * Float64(1.0 / r)) + Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25))); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (w <= 4.3e+176) tmp = ((2.0 / r) / r) + (-1.5 + ((w * (r * w)) * (((v * -0.25) - -0.375) / ((v + -1.0) / r)))); else tmp = ((2.0 / r) * (1.0 / r)) + (-1.5 - (((r * w) * (r * w)) * 0.25)); end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[w, 4.3e+176], N[(N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + N[(-1.5 + N[(N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(v * -0.25), $MachinePrecision] - -0.375), $MachinePrecision] / N[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 / r), $MachinePrecision] * N[(1.0 / r), $MachinePrecision]), $MachinePrecision] + N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 4.3 \cdot 10^{+176}:\\
\;\;\;\;\frac{\frac{2}{r}}{r} + \left(-1.5 + \left(w \cdot \left(r \cdot w\right)\right) \cdot \frac{v \cdot -0.25 - -0.375}{\frac{v + -1}{r}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{r} \cdot \frac{1}{r} + \left(-1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right)\\
\end{array}
\end{array}
if w < 4.30000000000000026e176Initial program 90.5%
Simplified99.4%
frac-2neg99.4%
*-commutative99.4%
associate-*r*91.8%
div-inv91.7%
associate-*r*99.4%
*-commutative99.4%
associate-*r*99.8%
pow299.8%
*-commutative99.8%
Applied egg-rr99.8%
associate-*r/99.8%
*-rgt-identity99.8%
neg-sub099.8%
fma-udef99.8%
*-commutative99.8%
+-commutative99.8%
associate--r+99.8%
metadata-eval99.8%
*-commutative99.8%
distribute-neg-frac99.8%
neg-sub099.8%
associate--r-99.8%
metadata-eval99.8%
*-commutative99.8%
Simplified99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.8%
+-commutative99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
+-commutative99.8%
Simplified99.8%
associate-/r*99.8%
*-rgt-identity99.8%
associate-/r*99.5%
associate-/r/99.4%
*-rgt-identity99.4%
+-commutative99.4%
Applied egg-rr99.4%
if 4.30000000000000026e176 < w Initial program 69.3%
Simplified84.9%
Taylor expanded in v around inf 69.3%
*-commutative69.3%
*-commutative69.3%
unpow269.3%
unpow269.3%
swap-sqr96.4%
unpow296.4%
*-commutative96.4%
Simplified96.4%
unpow2100.0%
Applied egg-rr96.4%
div-inv96.4%
Applied egg-rr96.4%
Final simplification99.0%
(FPCore (v w r) :precision binary64 (+ (- -1.5 (* (* (* r w) (* r w)) 0.25)) (/ -2.0 (* r (- r)))))
double code(double v, double w, double r) {
return (-1.5 - (((r * w) * (r * w)) * 0.25)) + (-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 = ((-1.5d0) - (((r * w) * (r * w)) * 0.25d0)) + ((-2.0d0) / (r * -r))
end function
public static double code(double v, double w, double r) {
return (-1.5 - (((r * w) * (r * w)) * 0.25)) + (-2.0 / (r * -r));
}
def code(v, w, r): return (-1.5 - (((r * w) * (r * w)) * 0.25)) + (-2.0 / (r * -r))
function code(v, w, r) return Float64(Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25)) + Float64(-2.0 / Float64(r * Float64(-r)))) end
function tmp = code(v, w, r) tmp = (-1.5 - (((r * w) * (r * w)) * 0.25)) + (-2.0 / (r * -r)); end
code[v_, w_, r_] := N[(N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] + N[(-2.0 / N[(r * (-r)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(-1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right) + \frac{-2}{r \cdot \left(-r\right)}
\end{array}
Initial program 87.8%
Simplified97.6%
Taylor expanded in v around inf 80.4%
*-commutative80.4%
*-commutative80.4%
unpow280.4%
unpow280.4%
swap-sqr94.5%
unpow294.5%
*-commutative94.5%
Simplified94.5%
unpow299.8%
Applied egg-rr94.5%
div-inv94.4%
Applied egg-rr94.4%
frac-2neg94.4%
metadata-eval94.4%
frac-times94.5%
metadata-eval94.5%
Applied egg-rr94.5%
Final simplification94.5%
(FPCore (v w r) :precision binary64 (+ (/ (/ 2.0 r) r) (- -1.5 (* (* (* r w) (* r w)) 0.25))))
double code(double v, double w, double r) {
return ((2.0 / r) / r) + (-1.5 - (((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 = ((2.0d0 / r) / r) + ((-1.5d0) - (((r * w) * (r * w)) * 0.25d0))
end function
public static double code(double v, double w, double r) {
return ((2.0 / r) / r) + (-1.5 - (((r * w) * (r * w)) * 0.25));
}
def code(v, w, r): return ((2.0 / r) / r) + (-1.5 - (((r * w) * (r * w)) * 0.25))
function code(v, w, r) return Float64(Float64(Float64(2.0 / r) / r) + Float64(-1.5 - Float64(Float64(Float64(r * w) * Float64(r * w)) * 0.25))) end
function tmp = code(v, w, r) tmp = ((2.0 / r) / r) + (-1.5 - (((r * w) * (r * w)) * 0.25)); end
code[v_, w_, r_] := N[(N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] + N[(-1.5 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{r}}{r} + \left(-1.5 - \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right) \cdot 0.25\right)
\end{array}
Initial program 87.8%
Simplified97.6%
Taylor expanded in v around inf 80.4%
*-commutative80.4%
*-commutative80.4%
unpow280.4%
unpow280.4%
swap-sqr94.5%
unpow294.5%
*-commutative94.5%
Simplified94.5%
unpow299.8%
Applied egg-rr94.5%
Final simplification94.5%
herbie shell --seed 2024027
(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))