
(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 6 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)) (/ (+ v -1.0) (* (* r w) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / ((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) + ((0.375d0 + (v * (-0.25d0))) / ((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 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w)))))
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(v + -1.0) / Float64(Float64(r * w) * Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / ((v + -1.0) / ((r * w) * (r * w))))); 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[(v + -1.0), $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{0.375 + v \cdot -0.25}{\frac{v + -1}{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}}\right)
\end{array}
Initial program 87.0%
Simplified89.2%
fma-undefine89.2%
*-commutative89.2%
+-commutative89.2%
metadata-eval89.2%
cancel-sign-sub-inv89.2%
associate-*r/89.1%
*-commutative89.1%
associate-/l*89.9%
clear-num89.8%
un-div-inv89.9%
cancel-sign-sub-inv89.9%
metadata-eval89.9%
distribute-rgt-in89.9%
metadata-eval89.9%
*-commutative89.9%
associate-*l*89.9%
metadata-eval89.9%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ (/ 2.0 (* r r)) 3.0)))
(if (<= v -5000000.0)
(- (+ t_0 (* (* r w) (/ (* w (* r (* v -0.25))) v))) 4.5)
(- (- t_0 (* (* r w) (* w (* r 0.375)))) 4.5))))
double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + 3.0;
double tmp;
if (v <= -5000000.0) {
tmp = (t_0 + ((r * w) * ((w * (r * (v * -0.25))) / v))) - 4.5;
} else {
tmp = (t_0 - ((r * w) * (w * (r * 0.375)))) - 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) :: t_0
real(8) :: tmp
t_0 = (2.0d0 / (r * r)) + 3.0d0
if (v <= (-5000000.0d0)) then
tmp = (t_0 + ((r * w) * ((w * (r * (v * (-0.25d0)))) / v))) - 4.5d0
else
tmp = (t_0 - ((r * w) * (w * (r * 0.375d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + 3.0;
double tmp;
if (v <= -5000000.0) {
tmp = (t_0 + ((r * w) * ((w * (r * (v * -0.25))) / v))) - 4.5;
} else {
tmp = (t_0 - ((r * w) * (w * (r * 0.375)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = (2.0 / (r * r)) + 3.0 tmp = 0 if v <= -5000000.0: tmp = (t_0 + ((r * w) * ((w * (r * (v * -0.25))) / v))) - 4.5 else: tmp = (t_0 - ((r * w) * (w * (r * 0.375)))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(2.0 / Float64(r * r)) + 3.0) tmp = 0.0 if (v <= -5000000.0) tmp = Float64(Float64(t_0 + Float64(Float64(r * w) * Float64(Float64(w * Float64(r * Float64(v * -0.25))) / v))) - 4.5); else tmp = Float64(Float64(t_0 - Float64(Float64(r * w) * Float64(w * Float64(r * 0.375)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (2.0 / (r * r)) + 3.0; tmp = 0.0; if (v <= -5000000.0) tmp = (t_0 + ((r * w) * ((w * (r * (v * -0.25))) / v))) - 4.5; else tmp = (t_0 - ((r * w) * (w * (r * 0.375)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision]}, If[LessEqual[v, -5000000.0], N[(N[(t$95$0 + N[(N[(r * w), $MachinePrecision] * N[(N[(w * N[(r * N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$0 - N[(N[(r * w), $MachinePrecision] * N[(w * N[(r * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r} + 3\\
\mathbf{if}\;v \leq -5000000:\\
\;\;\;\;\left(t\_0 + \left(r \cdot w\right) \cdot \frac{w \cdot \left(r \cdot \left(v \cdot -0.25\right)\right)}{v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot 0.375\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if v < -5e6Initial program 81.8%
associate-/l*88.1%
cancel-sign-sub-inv88.1%
metadata-eval88.1%
+-commutative88.1%
*-commutative88.1%
fma-undefine88.1%
*-commutative88.1%
*-commutative88.1%
associate-/l*88.1%
*-commutative88.1%
associate-*r/88.1%
associate-*r*83.1%
associate-*l*93.2%
associate-*r*89.9%
Applied egg-rr89.9%
*-commutative89.9%
associate-/r/89.9%
*-commutative89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in v around inf 84.1%
associate-*r*84.1%
*-commutative84.1%
*-commutative84.1%
associate-*r*89.3%
*-commutative89.3%
associate-*r*89.3%
*-commutative89.3%
associate-*l*84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in v around inf 85.7%
associate-*r/85.7%
*-commutative85.7%
neg-mul-185.7%
distribute-rgt-neg-in85.7%
Simplified85.7%
associate-*l/82.6%
associate-*r*91.2%
*-commutative91.2%
Applied egg-rr91.2%
associate-/l*94.3%
associate-*l*89.4%
Simplified89.4%
if -5e6 < v Initial program 88.5%
associate-/l*90.4%
cancel-sign-sub-inv90.4%
metadata-eval90.4%
+-commutative90.4%
*-commutative90.4%
fma-undefine90.4%
*-commutative90.4%
*-commutative90.4%
associate-/l*89.5%
*-commutative89.5%
associate-*r/89.5%
associate-*r*87.9%
associate-*l*94.5%
associate-*r*96.9%
Applied egg-rr96.8%
*-commutative96.8%
associate-/r/96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in v around 0 85.3%
Taylor expanded in v around 0 96.2%
Final simplification94.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ (/ 2.0 (* r r)) 3.0)))
(if (<= v -1700000.0)
(- (+ t_0 (/ (* (* (* v -0.25) (* r w)) (* r w)) v)) 4.5)
(- (- t_0 (* (* r w) (* w (* r 0.375)))) 4.5))))
double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + 3.0;
double tmp;
if (v <= -1700000.0) {
tmp = (t_0 + ((((v * -0.25) * (r * w)) * (r * w)) / v)) - 4.5;
} else {
tmp = (t_0 - ((r * w) * (w * (r * 0.375)))) - 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) :: t_0
real(8) :: tmp
t_0 = (2.0d0 / (r * r)) + 3.0d0
if (v <= (-1700000.0d0)) then
tmp = (t_0 + ((((v * (-0.25d0)) * (r * w)) * (r * w)) / v)) - 4.5d0
else
tmp = (t_0 - ((r * w) * (w * (r * 0.375d0)))) - 4.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + 3.0;
double tmp;
if (v <= -1700000.0) {
tmp = (t_0 + ((((v * -0.25) * (r * w)) * (r * w)) / v)) - 4.5;
} else {
tmp = (t_0 - ((r * w) * (w * (r * 0.375)))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = (2.0 / (r * r)) + 3.0 tmp = 0 if v <= -1700000.0: tmp = (t_0 + ((((v * -0.25) * (r * w)) * (r * w)) / v)) - 4.5 else: tmp = (t_0 - ((r * w) * (w * (r * 0.375)))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(Float64(2.0 / Float64(r * r)) + 3.0) tmp = 0.0 if (v <= -1700000.0) tmp = Float64(Float64(t_0 + Float64(Float64(Float64(Float64(v * -0.25) * Float64(r * w)) * Float64(r * w)) / v)) - 4.5); else tmp = Float64(Float64(t_0 - Float64(Float64(r * w) * Float64(w * Float64(r * 0.375)))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (2.0 / (r * r)) + 3.0; tmp = 0.0; if (v <= -1700000.0) tmp = (t_0 + ((((v * -0.25) * (r * w)) * (r * w)) / v)) - 4.5; else tmp = (t_0 - ((r * w) * (w * (r * 0.375)))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision]}, If[LessEqual[v, -1700000.0], N[(N[(t$95$0 + N[(N[(N[(N[(v * -0.25), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] / v), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(t$95$0 - N[(N[(r * w), $MachinePrecision] * N[(w * N[(r * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r} + 3\\
\mathbf{if}\;v \leq -1700000:\\
\;\;\;\;\left(t\_0 + \frac{\left(\left(v \cdot -0.25\right) \cdot \left(r \cdot w\right)\right) \cdot \left(r \cdot w\right)}{v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\left(t\_0 - \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot 0.375\right)\right)\right) - 4.5\\
\end{array}
\end{array}
if v < -1.7e6Initial program 81.8%
associate-/l*88.1%
cancel-sign-sub-inv88.1%
metadata-eval88.1%
+-commutative88.1%
*-commutative88.1%
fma-undefine88.1%
*-commutative88.1%
*-commutative88.1%
associate-/l*88.1%
*-commutative88.1%
associate-*r/88.1%
associate-*r*83.1%
associate-*l*93.2%
associate-*r*89.9%
Applied egg-rr89.9%
*-commutative89.9%
associate-/r/89.9%
*-commutative89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in v around inf 84.1%
associate-*r*84.1%
*-commutative84.1%
*-commutative84.1%
associate-*r*89.3%
*-commutative89.3%
associate-*r*89.3%
*-commutative89.3%
associate-*l*84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in v around inf 85.7%
associate-*r/85.7%
*-commutative85.7%
neg-mul-185.7%
distribute-rgt-neg-in85.7%
Simplified85.7%
associate-*l/82.6%
associate-*r*91.2%
*-commutative91.2%
Applied egg-rr91.2%
if -1.7e6 < v Initial program 88.5%
associate-/l*90.4%
cancel-sign-sub-inv90.4%
metadata-eval90.4%
+-commutative90.4%
*-commutative90.4%
fma-undefine90.4%
*-commutative90.4%
*-commutative90.4%
associate-/l*89.5%
*-commutative89.5%
associate-*r/89.5%
associate-*r*87.9%
associate-*l*94.5%
associate-*r*96.9%
Applied egg-rr96.8%
*-commutative96.8%
associate-/r/96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
Taylor expanded in v around 0 85.3%
Taylor expanded in v around 0 96.2%
Final simplification95.0%
(FPCore (v w r) :precision binary64 (- (- (+ (/ 2.0 (* r r)) 3.0) (* (* r w) (* 0.375 (* r w)))) 4.5))
double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = (((2.0d0 / (r * r)) + 3.0d0) - ((r * w) * (0.375d0 * (r * w)))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5;
}
def code(v, w, r): return (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(Float64(r * w) * Float64(0.375 * Float64(r * w)))) - 4.5) end
function tmp = code(v, w, r) tmp = (((2.0 / (r * r)) + 3.0) - ((r * w) * (0.375 * (r * w)))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(0.375 * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{2}{r \cdot r} + 3\right) - \left(r \cdot w\right) \cdot \left(0.375 \cdot \left(r \cdot w\right)\right)\right) - 4.5
\end{array}
Initial program 87.0%
associate-/l*89.8%
cancel-sign-sub-inv89.8%
metadata-eval89.8%
+-commutative89.8%
*-commutative89.8%
fma-undefine89.8%
*-commutative89.8%
*-commutative89.8%
associate-/l*89.1%
*-commutative89.1%
associate-*r/89.1%
associate-*r*86.8%
associate-*l*94.2%
associate-*r*95.3%
Applied egg-rr95.3%
*-commutative95.3%
associate-/r/95.2%
*-commutative95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in v around 0 82.8%
Taylor expanded in v around 0 93.0%
Final simplification93.0%
(FPCore (v w r) :precision binary64 (- (- (+ (/ 2.0 (* r r)) 3.0) (* (* r w) (* w (* r 0.375)))) 4.5))
double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - ((r * w) * (w * (r * 0.375)))) - 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) - ((r * w) * (w * (r * 0.375d0)))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return (((2.0 / (r * r)) + 3.0) - ((r * w) * (w * (r * 0.375)))) - 4.5;
}
def code(v, w, r): return (((2.0 / (r * r)) + 3.0) - ((r * w) * (w * (r * 0.375)))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(Float64(2.0 / Float64(r * r)) + 3.0) - Float64(Float64(r * w) * Float64(w * Float64(r * 0.375)))) - 4.5) end
function tmp = code(v, w, r) tmp = (((2.0 / (r * r)) + 3.0) - ((r * w) * (w * (r * 0.375)))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + 3.0), $MachinePrecision] - N[(N[(r * w), $MachinePrecision] * N[(w * N[(r * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{2}{r \cdot r} + 3\right) - \left(r \cdot w\right) \cdot \left(w \cdot \left(r \cdot 0.375\right)\right)\right) - 4.5
\end{array}
Initial program 87.0%
associate-/l*89.8%
cancel-sign-sub-inv89.8%
metadata-eval89.8%
+-commutative89.8%
*-commutative89.8%
fma-undefine89.8%
*-commutative89.8%
*-commutative89.8%
associate-/l*89.1%
*-commutative89.1%
associate-*r/89.1%
associate-*r*86.8%
associate-*l*94.2%
associate-*r*95.3%
Applied egg-rr95.3%
*-commutative95.3%
associate-/r/95.2%
*-commutative95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in v around 0 82.8%
Taylor expanded in v around 0 93.0%
Final simplification93.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.0%
Simplified82.9%
Taylor expanded in r around 0 57.1%
Final simplification57.1%
herbie shell --seed 2024039
(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))