
(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 8 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 (+ (+ 3.0 (/ 2.0 (* r r))) (- (* (* 0.125 (+ 3.0 (* -2.0 v))) (* (* r w) (/ w (/ (+ v -1.0) r)))) 4.5)))
double code(double v, double w, double r) {
return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / 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))) + (((0.125d0 * (3.0d0 + ((-2.0d0) * v))) * ((r * w) * (w / ((v + (-1.0d0)) / r)))) - 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))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5);
}
def code(v, w, r): return (3.0 + (2.0 / (r * r))) + (((0.125 * (3.0 + (-2.0 * v))) * ((r * w) * (w / ((v + -1.0) / r)))) - 4.5)
function code(v, w, r) return Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(-2.0 * v))) * Float64(Float64(r * w) * Float64(w / Float64(Float64(v + -1.0) / r)))) - 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) * (w / ((v + -1.0) / r)))) - 4.5); end
code[v_, w_, r_] := 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[(r * w), $MachinePrecision] * N[(w / N[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(3 + \frac{2}{r \cdot r}\right) + \left(\left(0.125 \cdot \left(3 + -2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \frac{w}{\frac{v + -1}{r}}\right) - 4.5\right)
\end{array}
Initial program 84.8%
associate--l-84.8%
associate-*l*79.9%
sqr-neg79.9%
associate-*l*84.8%
associate-/l*87.7%
fma-define87.7%
Simplified87.7%
associate-/l*87.7%
*-commutative87.7%
associate-*r/87.7%
associate-*l*97.2%
associate-*r*99.8%
add-sqr-sqrt48.3%
associate-*l*48.3%
add-sqr-sqrt22.2%
sqrt-prod36.7%
sqrt-prod36.7%
sqrt-prod74.4%
*-commutative74.4%
sqrt-prod36.7%
*-commutative36.7%
sqrt-prod36.7%
sqrt-prod22.2%
add-sqr-sqrt48.3%
associate-*r*48.3%
add-sqr-sqrt99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v -1.2e+22)
(+ t_0 (- -1.5 (* (* r (* w (* r w))) 0.25)))
(if (<= v 2.2e-17)
(- (- (+ 3.0 t_0) (* (/ w (/ (- 1.0 v) r)) (* r (* w 0.375)))) 4.5)
(+ t_0 (- -1.5 (* (* (* r w) (* r w)) 0.25)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -1.2e+22) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 2.2e-17) {
tmp = ((3.0 + t_0) - ((w / ((1.0 - v) / r)) * (r * (w * 0.375)))) - 4.5;
} else {
tmp = t_0 + (-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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (v <= (-1.2d+22)) then
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * 0.25d0))
else if (v <= 2.2d-17) then
tmp = ((3.0d0 + t_0) - ((w / ((1.0d0 - v) / r)) * (r * (w * 0.375d0)))) - 4.5d0
else
tmp = t_0 + ((-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 t_0 = 2.0 / (r * r);
double tmp;
if (v <= -1.2e+22) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 2.2e-17) {
tmp = ((3.0 + t_0) - ((w / ((1.0 - v) / r)) * (r * (w * 0.375)))) - 4.5;
} else {
tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= -1.2e+22: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)) elif v <= 2.2e-17: tmp = ((3.0 + t_0) - ((w / ((1.0 - v) / r)) * (r * (w * 0.375)))) - 4.5 else: tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25)) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -1.2e+22) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * 0.25))); elseif (v <= 2.2e-17) tmp = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(w / Float64(Float64(1.0 - v) / r)) * Float64(r * Float64(w * 0.375)))) - 4.5); else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(r * w) * 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 (v <= -1.2e+22) tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)); elseif (v <= 2.2e-17) tmp = ((3.0 + t_0) - ((w / ((1.0 - v) / r)) * (r * (w * 0.375)))) - 4.5; else tmp = t_0 + (-1.5 - (((r * w) * (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[v, -1.2e+22], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 2.2e-17], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(w / N[(N[(1.0 - v), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision] * N[(r * N[(w * 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + 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}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -1.2 \cdot 10^{+22}:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\mathbf{elif}\;v \leq 2.2 \cdot 10^{-17}:\\
\;\;\;\;\left(\left(3 + t\_0\right) - \frac{w}{\frac{1 - v}{r}} \cdot \left(r \cdot \left(w \cdot 0.375\right)\right)\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \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 v < -1.2e22Initial program 80.3%
Simplified86.2%
Taylor expanded in v around inf 79.9%
*-commutative79.9%
*-commutative79.9%
unpow279.9%
unpow279.9%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
*-commutative99.8%
unpow299.8%
associate-*r*99.9%
Applied egg-rr99.9%
if -1.2e22 < v < 2.2e-17Initial program 85.5%
associate-/l*85.5%
cancel-sign-sub-inv85.5%
metadata-eval85.5%
+-commutative85.5%
*-commutative85.5%
fma-undefine85.5%
*-commutative85.5%
*-commutative85.5%
associate-/l*85.5%
*-commutative85.5%
associate-*r/85.5%
associate-*r*85.5%
associate-*l*95.7%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
*-commutative99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
if 2.2e-17 < v Initial program 87.8%
Simplified92.9%
Taylor expanded in v around inf 89.7%
*-commutative89.7%
*-commutative89.7%
unpow289.7%
unpow289.7%
swap-sqr99.2%
unpow299.2%
*-commutative99.2%
Simplified99.2%
*-commutative99.2%
unpow299.2%
Applied egg-rr99.2%
Final simplification99.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= v -1.25e+21)
(+ t_0 (- -1.5 (* (* r (* w (* r w))) 0.25)))
(if (<= v 1e-17)
(- (+ (+ 3.0 t_0) (* (* (* r w) 0.375) (/ w (/ (+ v -1.0) r)))) 4.5)
(+ t_0 (- -1.5 (* (* (* r w) (* r w)) 0.25)))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (v <= -1.25e+21) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 1e-17) {
tmp = ((3.0 + t_0) + (((r * w) * 0.375) * (w / ((v + -1.0) / r)))) - 4.5;
} else {
tmp = t_0 + (-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) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if (v <= (-1.25d+21)) then
tmp = t_0 + ((-1.5d0) - ((r * (w * (r * w))) * 0.25d0))
else if (v <= 1d-17) then
tmp = ((3.0d0 + t_0) + (((r * w) * 0.375d0) * (w / ((v + (-1.0d0)) / r)))) - 4.5d0
else
tmp = t_0 + ((-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 t_0 = 2.0 / (r * r);
double tmp;
if (v <= -1.25e+21) {
tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25));
} else if (v <= 1e-17) {
tmp = ((3.0 + t_0) + (((r * w) * 0.375) * (w / ((v + -1.0) / r)))) - 4.5;
} else {
tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if v <= -1.25e+21: tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)) elif v <= 1e-17: tmp = ((3.0 + t_0) + (((r * w) * 0.375) * (w / ((v + -1.0) / r)))) - 4.5 else: tmp = t_0 + (-1.5 - (((r * w) * (r * w)) * 0.25)) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (v <= -1.25e+21) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(r * Float64(w * Float64(r * w))) * 0.25))); elseif (v <= 1e-17) tmp = Float64(Float64(Float64(3.0 + t_0) + Float64(Float64(Float64(r * w) * 0.375) * Float64(w / Float64(Float64(v + -1.0) / r)))) - 4.5); else tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(Float64(r * w) * 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 (v <= -1.25e+21) tmp = t_0 + (-1.5 - ((r * (w * (r * w))) * 0.25)); elseif (v <= 1e-17) tmp = ((3.0 + t_0) + (((r * w) * 0.375) * (w / ((v + -1.0) / r)))) - 4.5; else tmp = t_0 + (-1.5 - (((r * w) * (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[v, -1.25e+21], N[(t$95$0 + N[(-1.5 - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[v, 1e-17], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] + N[(N[(N[(r * w), $MachinePrecision] * 0.375), $MachinePrecision] * N[(w / N[(N[(v + -1.0), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(t$95$0 + 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}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;v \leq -1.25 \cdot 10^{+21}:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(r \cdot \left(w \cdot \left(r \cdot w\right)\right)\right) \cdot 0.25\right)\\
\mathbf{elif}\;v \leq 10^{-17}:\\
\;\;\;\;\left(\left(3 + t\_0\right) + \left(\left(r \cdot w\right) \cdot 0.375\right) \cdot \frac{w}{\frac{v + -1}{r}}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \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 v < -1.25e21Initial program 80.3%
Simplified86.2%
Taylor expanded in v around inf 79.9%
*-commutative79.9%
*-commutative79.9%
unpow279.9%
unpow279.9%
swap-sqr99.8%
unpow299.8%
*-commutative99.8%
Simplified99.8%
*-commutative99.8%
unpow299.8%
associate-*r*99.9%
Applied egg-rr99.9%
if -1.25e21 < v < 1.00000000000000007e-17Initial program 85.5%
associate-/l*85.5%
cancel-sign-sub-inv85.5%
metadata-eval85.5%
+-commutative85.5%
*-commutative85.5%
fma-undefine85.5%
*-commutative85.5%
*-commutative85.5%
associate-/l*85.5%
*-commutative85.5%
associate-*r/85.5%
associate-*r*85.5%
associate-*l*95.7%
associate-*r*99.8%
Applied egg-rr99.8%
Taylor expanded in v around 0 99.8%
if 1.00000000000000007e-17 < v Initial program 87.8%
Simplified92.9%
Taylor expanded in v around inf 89.7%
*-commutative89.7%
*-commutative89.7%
unpow289.7%
unpow289.7%
swap-sqr99.2%
unpow299.2%
*-commutative99.2%
Simplified99.2%
*-commutative99.2%
unpow299.2%
Applied egg-rr99.2%
Final simplification99.7%
(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 84.8%
Simplified87.7%
fma-undefine87.7%
*-commutative87.7%
+-commutative87.7%
metadata-eval87.7%
cancel-sign-sub-inv87.7%
associate-*r/87.7%
*-commutative87.7%
associate-/l*87.7%
clear-num87.7%
un-div-inv87.7%
cancel-sign-sub-inv87.7%
metadata-eval87.7%
distribute-rgt-in87.7%
metadata-eval87.7%
*-commutative87.7%
associate-*l*87.7%
metadata-eval87.7%
Applied egg-rr99.8%
unpow299.8%
Applied egg-rr99.8%
Final simplification99.8%
(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(2.0 / Float64(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[(2.0 / N[(r * 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}
\\
\frac{2}{r \cdot 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 84.8%
Simplified87.7%
Taylor expanded in v around inf 79.8%
*-commutative79.8%
*-commutative79.8%
unpow279.8%
unpow279.8%
swap-sqr94.7%
unpow294.7%
*-commutative94.7%
Simplified94.7%
*-commutative94.7%
unpow294.7%
Applied egg-rr94.7%
Final simplification94.7%
(FPCore (v w r) :precision binary64 (- -1.5 (/ -2.0 (* r r))))
double code(double v, double w, double r) {
return -1.5 - (-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) - ((-2.0d0) / (r * r))
end function
public static double code(double v, double w, double r) {
return -1.5 - (-2.0 / (r * r));
}
def code(v, w, r): return -1.5 - (-2.0 / (r * r))
function code(v, w, r) return Float64(-1.5 - Float64(-2.0 / Float64(r * r))) end
function tmp = code(v, w, r) tmp = -1.5 - (-2.0 / (r * r)); end
code[v_, w_, r_] := N[(-1.5 - N[(-2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 - \frac{-2}{r \cdot r}
\end{array}
Initial program 84.8%
Simplified81.8%
Taylor expanded in r around 0 59.9%
+-commutative59.9%
associate--l+59.9%
div-inv59.9%
pow259.9%
pow-flip60.0%
metadata-eval60.0%
metadata-eval60.0%
Applied egg-rr60.0%
sqr-pow59.8%
metadata-eval59.8%
inv-pow59.8%
metadata-eval59.8%
inv-pow59.8%
associate-*r*59.8%
div-inv59.8%
frac-2neg59.8%
metadata-eval59.8%
frac-times59.9%
metadata-eval59.9%
Applied egg-rr59.9%
Final simplification59.9%
(FPCore (v w r) :precision binary64 (+ -1.5 (/ (/ 2.0 r) r)))
double code(double v, double w, double r) {
return -1.5 + ((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) + ((2.0d0 / r) / r)
end function
public static double code(double v, double w, double r) {
return -1.5 + ((2.0 / r) / r);
}
def code(v, w, r): return -1.5 + ((2.0 / r) / r)
function code(v, w, r) return Float64(-1.5 + Float64(Float64(2.0 / r) / r)) end
function tmp = code(v, w, r) tmp = -1.5 + ((2.0 / r) / r); end
code[v_, w_, r_] := N[(-1.5 + N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \frac{\frac{2}{r}}{r}
\end{array}
Initial program 84.8%
Simplified81.8%
Taylor expanded in r around 0 59.9%
+-commutative59.9%
associate--l+59.9%
div-inv59.9%
pow259.9%
pow-flip60.0%
metadata-eval60.0%
metadata-eval60.0%
Applied egg-rr60.0%
sqr-pow59.8%
metadata-eval59.8%
inv-pow59.8%
metadata-eval59.8%
inv-pow59.8%
associate-*r*59.8%
div-inv59.8%
div-inv59.9%
Applied egg-rr59.9%
Final simplification59.9%
(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 84.8%
Simplified81.8%
Taylor expanded in r around 0 59.9%
Taylor expanded in r around inf 14.9%
herbie shell --seed 2024085
(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))