
(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 12 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)) (* (/ (/ 1.0 w) r) (/ (+ v -1.0) (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 / w) / r) * ((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) + ((0.375d0 + (v * (-0.25d0))) / (((1.0d0 / w) / r) * ((v + (-1.0d0)) / (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)) / (((1.0 / w) / r) * ((v + -1.0) / (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 / w) / r) * ((v + -1.0) / (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(Float64(1.0 / w) / r) * Float64(Float64(v + -1.0) / Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 / w) / r) * ((v + -1.0) / (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[(N[(1.0 / w), $MachinePrecision] / r), $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{0.375 + v \cdot -0.25}{\frac{\frac{1}{w}}{r} \cdot \frac{v + -1}{r \cdot w}}\right)
\end{array}
Initial program 83.9%
Simplified85.4%
*-commutative85.4%
fma-undefine85.4%
*-commutative85.4%
+-commutative85.4%
metadata-eval85.4%
cancel-sign-sub-inv85.4%
associate-*r/85.4%
*-commutative85.4%
associate-/l*85.8%
*-commutative85.8%
clear-num85.8%
un-div-inv85.8%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.8%
Applied egg-rr99.8%
inv-pow99.8%
unpow-prod-down99.8%
inv-pow99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-lft-identity99.8%
unpow-199.8%
Simplified99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (+ 0.375 (* v -0.25))))
(if (<= r 1.2e-95)
(+ t_0 (+ -1.5 (/ t_1 (* (/ (/ 1.0 w) r) (/ (/ -1.0 r) w)))))
(if (<= r 1.82e+50)
(+ t_0 (- -1.5 (* t_1 (* r (* (* w w) (/ r (- 1.0 v)))))))
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* v -2.0))) (* w (* r (* w (/ r (+ v -1.0))))))
4.5))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = 0.375 + (v * -0.25);
double tmp;
if (r <= 1.2e-95) {
tmp = t_0 + (-1.5 + (t_1 / (((1.0 / w) / r) * ((-1.0 / r) / w))));
} else if (r <= 1.82e+50) {
tmp = t_0 + (-1.5 - (t_1 * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * (r / (v + -1.0)))))) - 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) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = 0.375d0 + (v * (-0.25d0))
if (r <= 1.2d-95) then
tmp = t_0 + ((-1.5d0) + (t_1 / (((1.0d0 / w) / r) * (((-1.0d0) / r) / w))))
else if (r <= 1.82d+50) then
tmp = t_0 + ((-1.5d0) - (t_1 * (r * ((w * w) * (r / (1.0d0 - v))))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * (w * (r * (w * (r / (v + (-1.0d0))))))) - 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);
double t_1 = 0.375 + (v * -0.25);
double tmp;
if (r <= 1.2e-95) {
tmp = t_0 + (-1.5 + (t_1 / (((1.0 / w) / r) * ((-1.0 / r) / w))));
} else if (r <= 1.82e+50) {
tmp = t_0 + (-1.5 - (t_1 * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * (r / (v + -1.0)))))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = 0.375 + (v * -0.25) tmp = 0 if r <= 1.2e-95: tmp = t_0 + (-1.5 + (t_1 / (((1.0 / w) / r) * ((-1.0 / r) / w)))) elif r <= 1.82e+50: tmp = t_0 + (-1.5 - (t_1 * (r * ((w * w) * (r / (1.0 - v)))))) else: tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * (r / (v + -1.0)))))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(0.375 + Float64(v * -0.25)) tmp = 0.0 if (r <= 1.2e-95) tmp = Float64(t_0 + Float64(-1.5 + Float64(t_1 / Float64(Float64(Float64(1.0 / w) / r) * Float64(Float64(-1.0 / r) / w))))); elseif (r <= 1.82e+50) tmp = Float64(t_0 + Float64(-1.5 - Float64(t_1 * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v))))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(w * Float64(r * Float64(w * Float64(r / Float64(v + -1.0)))))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = 0.375 + (v * -0.25); tmp = 0.0; if (r <= 1.2e-95) tmp = t_0 + (-1.5 + (t_1 / (((1.0 / w) / r) * ((-1.0 / r) / w)))); elseif (r <= 1.82e+50) tmp = t_0 + (-1.5 - (t_1 * (r * ((w * w) * (r / (1.0 - v)))))); else tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * (r / (v + -1.0)))))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1.2e-95], N[(t$95$0 + N[(-1.5 + N[(t$95$1 / N[(N[(N[(1.0 / w), $MachinePrecision] / r), $MachinePrecision] * N[(N[(-1.0 / r), $MachinePrecision] / w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, 1.82e+50], N[(t$95$0 + N[(-1.5 - N[(t$95$1 * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := 0.375 + v \cdot -0.25\\
\mathbf{if}\;r \leq 1.2 \cdot 10^{-95}:\\
\;\;\;\;t\_0 + \left(-1.5 + \frac{t\_1}{\frac{\frac{1}{w}}{r} \cdot \frac{\frac{-1}{r}}{w}}\right)\\
\mathbf{elif}\;r \leq 1.82 \cdot 10^{+50}:\\
\;\;\;\;t\_0 + \left(-1.5 - t\_1 \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(w \cdot \left(r \cdot \left(w \cdot \frac{r}{v + -1}\right)\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 1.2e-95Initial program 79.3%
Simplified80.4%
*-commutative80.4%
fma-undefine80.4%
*-commutative80.4%
+-commutative80.4%
metadata-eval80.4%
cancel-sign-sub-inv80.4%
associate-*r/80.4%
*-commutative80.4%
associate-/l*81.0%
*-commutative81.0%
clear-num81.0%
un-div-inv81.0%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.8%
Applied egg-rr99.8%
inv-pow99.8%
unpow-prod-down99.9%
inv-pow99.9%
Applied egg-rr99.9%
associate-*l/99.9%
*-lft-identity99.9%
unpow-199.9%
Simplified99.9%
Taylor expanded in v around 0 81.0%
associate-/r*81.0%
Simplified81.0%
if 1.2e-95 < r < 1.81999999999999997e50Initial program 93.8%
Simplified96.9%
fma-undefine96.9%
*-commutative96.9%
distribute-rgt-in96.9%
*-commutative96.9%
associate-*l*96.9%
metadata-eval96.9%
metadata-eval96.9%
Applied egg-rr96.9%
if 1.81999999999999997e50 < r Initial program 93.3%
Simplified95.1%
Taylor expanded in r around inf 95.1%
associate-/l*95.1%
*-commutative95.1%
associate-*r/95.1%
*-commutative95.1%
associate-*l*99.8%
associate-*l*98.0%
Applied egg-rr98.0%
Final simplification86.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 8.5e-112)
(+ t_0 -1.5)
(if (<= r 2.7e+50)
(+
t_0
(- -1.5 (* (+ 0.375 (* v -0.25)) (* r (* (* w w) (/ r (- 1.0 v)))))))
(+
3.0
(-
(* (* 0.125 (+ 3.0 (* v -2.0))) (* w (* r (* w (/ r (+ v -1.0))))))
4.5))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 8.5e-112) {
tmp = t_0 + -1.5;
} else if (r <= 2.7e+50) {
tmp = t_0 + (-1.5 - ((0.375 + (v * -0.25)) * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * (r / (v + -1.0)))))) - 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)
if (r <= 8.5d-112) then
tmp = t_0 + (-1.5d0)
else if (r <= 2.7d+50) then
tmp = t_0 + ((-1.5d0) - ((0.375d0 + (v * (-0.25d0))) * (r * ((w * w) * (r / (1.0d0 - v))))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * (w * (r * (w * (r / (v + (-1.0d0))))))) - 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);
double tmp;
if (r <= 8.5e-112) {
tmp = t_0 + -1.5;
} else if (r <= 2.7e+50) {
tmp = t_0 + (-1.5 - ((0.375 + (v * -0.25)) * (r * ((w * w) * (r / (1.0 - v))))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * (r / (v + -1.0)))))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 8.5e-112: tmp = t_0 + -1.5 elif r <= 2.7e+50: tmp = t_0 + (-1.5 - ((0.375 + (v * -0.25)) * (r * ((w * w) * (r / (1.0 - v)))))) else: tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * (r / (v + -1.0)))))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 8.5e-112) tmp = Float64(t_0 + -1.5); elseif (r <= 2.7e+50) tmp = Float64(t_0 + Float64(-1.5 - Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(1.0 - v))))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(w * Float64(r * Float64(w * Float64(r / Float64(v + -1.0)))))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 8.5e-112) tmp = t_0 + -1.5; elseif (r <= 2.7e+50) tmp = t_0 + (-1.5 - ((0.375 + (v * -0.25)) * (r * ((w * w) * (r / (1.0 - v)))))); else tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * (r * (w * (r / (v + -1.0)))))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 8.5e-112], N[(t$95$0 + -1.5), $MachinePrecision], If[LessEqual[r, 2.7e+50], N[(t$95$0 + N[(-1.5 - N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 8.5 \cdot 10^{-112}:\\
\;\;\;\;t\_0 + -1.5\\
\mathbf{elif}\;r \leq 2.7 \cdot 10^{+50}:\\
\;\;\;\;t\_0 + \left(-1.5 - \left(0.375 + v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{1 - v}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(w \cdot \left(r \cdot \left(w \cdot \frac{r}{v + -1}\right)\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 8.49999999999999992e-112Initial program 79.9%
Simplified81.1%
Taylor expanded in v around inf 78.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in r around 0 65.1%
if 8.49999999999999992e-112 < r < 2.7e50Initial program 89.3%
Simplified92.1%
fma-undefine92.1%
*-commutative92.1%
distribute-rgt-in92.1%
*-commutative92.1%
associate-*l*92.1%
metadata-eval92.1%
metadata-eval92.1%
Applied egg-rr92.1%
if 2.7e50 < r Initial program 93.3%
Simplified95.1%
Taylor expanded in r around inf 95.1%
associate-/l*95.1%
*-commutative95.1%
associate-*r/95.1%
*-commutative95.1%
associate-*l*99.8%
associate-*l*98.0%
Applied egg-rr98.0%
Final simplification75.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))) (t_1 (/ r (+ v -1.0))))
(if (<= r 4.8e-109)
(+ t_0 -1.5)
(if (<= r 6.5e+43)
(+ t_0 (+ -1.5 (* (* v -0.25) (* r (* (* w w) t_1)))))
(+
3.0
(- (* (* 0.125 (+ 3.0 (* v -2.0))) (* w (* (* r w) t_1))) 4.5))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double t_1 = r / (v + -1.0);
double tmp;
if (r <= 4.8e-109) {
tmp = t_0 + -1.5;
} else if (r <= 6.5e+43) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * ((r * w) * t_1))) - 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) :: t_1
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
t_1 = r / (v + (-1.0d0))
if (r <= 4.8d-109) then
tmp = t_0 + (-1.5d0)
else if (r <= 6.5d+43) then
tmp = t_0 + ((-1.5d0) + ((v * (-0.25d0)) * (r * ((w * w) * t_1))))
else
tmp = 3.0d0 + (((0.125d0 * (3.0d0 + (v * (-2.0d0)))) * (w * ((r * w) * t_1))) - 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);
double t_1 = r / (v + -1.0);
double tmp;
if (r <= 4.8e-109) {
tmp = t_0 + -1.5;
} else if (r <= 6.5e+43) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1))));
} else {
tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * ((r * w) * t_1))) - 4.5);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) t_1 = r / (v + -1.0) tmp = 0 if r <= 4.8e-109: tmp = t_0 + -1.5 elif r <= 6.5e+43: tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1)))) else: tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * ((r * w) * t_1))) - 4.5) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) t_1 = Float64(r / Float64(v + -1.0)) tmp = 0.0 if (r <= 4.8e-109) tmp = Float64(t_0 + -1.5); elseif (r <= 6.5e+43) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(v * -0.25) * Float64(r * Float64(Float64(w * w) * t_1))))); else tmp = Float64(3.0 + Float64(Float64(Float64(0.125 * Float64(3.0 + Float64(v * -2.0))) * Float64(w * Float64(Float64(r * w) * t_1))) - 4.5)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); t_1 = r / (v + -1.0); tmp = 0.0; if (r <= 4.8e-109) tmp = t_0 + -1.5; elseif (r <= 6.5e+43) tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * t_1)))); else tmp = 3.0 + (((0.125 * (3.0 + (v * -2.0))) * (w * ((r * w) * t_1))) - 4.5); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 4.8e-109], N[(t$95$0 + -1.5), $MachinePrecision], If[LessEqual[r, 6.5e+43], N[(t$95$0 + N[(-1.5 + N[(N[(v * -0.25), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 + N[(N[(N[(0.125 * N[(3.0 + N[(v * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(N[(r * w), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
t_1 := \frac{r}{v + -1}\\
\mathbf{if}\;r \leq 4.8 \cdot 10^{-109}:\\
\;\;\;\;t\_0 + -1.5\\
\mathbf{elif}\;r \leq 6.5 \cdot 10^{+43}:\\
\;\;\;\;t\_0 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot t\_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;3 + \left(\left(0.125 \cdot \left(3 + v \cdot -2\right)\right) \cdot \left(w \cdot \left(\left(r \cdot w\right) \cdot t\_1\right)\right) - 4.5\right)\\
\end{array}
\end{array}
if r < 4.79999999999999977e-109Initial program 79.6%
Simplified80.7%
Taylor expanded in v around inf 78.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in r around 0 64.9%
if 4.79999999999999977e-109 < r < 6.4999999999999998e43Initial program 90.9%
Simplified94.0%
Taylor expanded in v around inf 88.5%
*-commutative88.5%
Simplified88.5%
if 6.4999999999999998e43 < r Initial program 93.5%
Simplified95.2%
Taylor expanded in r around inf 95.2%
associate-/l*95.3%
*-commutative95.3%
associate-*r/95.2%
associate-*l*99.8%
associate-*r*99.8%
add-sqr-sqrt99.6%
associate-*l*99.6%
add-sqr-sqrt60.2%
sqrt-prod68.0%
sqrt-prod68.1%
sqrt-prod68.2%
associate-*l*68.2%
*-commutative68.2%
associate-*l*68.2%
Applied egg-rr98.1%
Final simplification74.7%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 4e-108)
(+ t_0 -1.5)
(if (<= r 2.25e+45)
(+ t_0 (+ -1.5 (* (* v -0.25) (* r (* (* w w) (/ r (+ v -1.0)))))))
(-
(+ 3.0 (/ (* (+ 0.375 (* v -0.25)) (* r (* r (* w w)))) (+ v -1.0)))
4.5)))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 4e-108) {
tmp = t_0 + -1.5;
} else if (r <= 2.25e+45) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = (3.0 + (((0.375 + (v * -0.25)) * (r * (r * (w * w)))) / (v + -1.0))) - 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)
if (r <= 4d-108) then
tmp = t_0 + (-1.5d0)
else if (r <= 2.25d+45) then
tmp = t_0 + ((-1.5d0) + ((v * (-0.25d0)) * (r * ((w * w) * (r / (v + (-1.0d0)))))))
else
tmp = (3.0d0 + (((0.375d0 + (v * (-0.25d0))) * (r * (r * (w * w)))) / (v + (-1.0d0)))) - 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);
double tmp;
if (r <= 4e-108) {
tmp = t_0 + -1.5;
} else if (r <= 2.25e+45) {
tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0))))));
} else {
tmp = (3.0 + (((0.375 + (v * -0.25)) * (r * (r * (w * w)))) / (v + -1.0))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 4e-108: tmp = t_0 + -1.5 elif r <= 2.25e+45: tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0)))))) else: tmp = (3.0 + (((0.375 + (v * -0.25)) * (r * (r * (w * w)))) / (v + -1.0))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 4e-108) tmp = Float64(t_0 + -1.5); elseif (r <= 2.25e+45) tmp = Float64(t_0 + Float64(-1.5 + Float64(Float64(v * -0.25) * Float64(r * Float64(Float64(w * w) * Float64(r / Float64(v + -1.0))))))); else tmp = Float64(Float64(3.0 + Float64(Float64(Float64(0.375 + Float64(v * -0.25)) * Float64(r * Float64(r * Float64(w * w)))) / Float64(v + -1.0))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 4e-108) tmp = t_0 + -1.5; elseif (r <= 2.25e+45) tmp = t_0 + (-1.5 + ((v * -0.25) * (r * ((w * w) * (r / (v + -1.0)))))); else tmp = (3.0 + (((0.375 + (v * -0.25)) * (r * (r * (w * w)))) / (v + -1.0))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 4e-108], N[(t$95$0 + -1.5), $MachinePrecision], If[LessEqual[r, 2.25e+45], N[(t$95$0 + N[(-1.5 + N[(N[(v * -0.25), $MachinePrecision] * N[(r * N[(N[(w * w), $MachinePrecision] * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision] * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 4 \cdot 10^{-108}:\\
\;\;\;\;t\_0 + -1.5\\
\mathbf{elif}\;r \leq 2.25 \cdot 10^{+45}:\\
\;\;\;\;t\_0 + \left(-1.5 + \left(v \cdot -0.25\right) \cdot \left(r \cdot \left(\left(w \cdot w\right) \cdot \frac{r}{v + -1}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \frac{\left(0.375 + v \cdot -0.25\right) \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)}{v + -1}\right) - 4.5\\
\end{array}
\end{array}
if r < 4.00000000000000016e-108Initial program 79.6%
Simplified80.7%
Taylor expanded in v around inf 78.1%
*-commutative78.1%
Simplified78.1%
Taylor expanded in r around 0 64.9%
if 4.00000000000000016e-108 < r < 2.2499999999999999e45Initial program 90.9%
Simplified94.0%
Taylor expanded in v around inf 88.5%
*-commutative88.5%
Simplified88.5%
if 2.2499999999999999e45 < r Initial program 93.5%
Taylor expanded in r around inf 93.5%
Taylor expanded in v around 0 93.5%
Final simplification73.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 9e-112)
(+ t_0 -1.5)
(if (<= r 7e+158)
(+ t_0 (- -1.5 (* 0.375 (* r (* r (* w w))))))
(-
(+ 3.0 (* (* w (* r (+ 0.375 (* v -0.25)))) (* w (/ r (+ v -1.0)))))
4.5)))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 9e-112) {
tmp = t_0 + -1.5;
} else if (r <= 7e+158) {
tmp = t_0 + (-1.5 - (0.375 * (r * (r * (w * w)))));
} else {
tmp = (3.0 + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 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)
if (r <= 9d-112) then
tmp = t_0 + (-1.5d0)
else if (r <= 7d+158) then
tmp = t_0 + ((-1.5d0) - (0.375d0 * (r * (r * (w * w)))))
else
tmp = (3.0d0 + ((w * (r * (0.375d0 + (v * (-0.25d0))))) * (w * (r / (v + (-1.0d0)))))) - 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);
double tmp;
if (r <= 9e-112) {
tmp = t_0 + -1.5;
} else if (r <= 7e+158) {
tmp = t_0 + (-1.5 - (0.375 * (r * (r * (w * w)))));
} else {
tmp = (3.0 + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5;
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 9e-112: tmp = t_0 + -1.5 elif r <= 7e+158: tmp = t_0 + (-1.5 - (0.375 * (r * (r * (w * w))))) else: tmp = (3.0 + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5 return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 9e-112) tmp = Float64(t_0 + -1.5); elseif (r <= 7e+158) tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w)))))); else tmp = Float64(Float64(3.0 + Float64(Float64(w * Float64(r * Float64(0.375 + Float64(v * -0.25)))) * Float64(w * Float64(r / Float64(v + -1.0))))) - 4.5); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 9e-112) tmp = t_0 + -1.5; elseif (r <= 7e+158) tmp = t_0 + (-1.5 - (0.375 * (r * (r * (w * w))))); else tmp = (3.0 + ((w * (r * (0.375 + (v * -0.25)))) * (w * (r / (v + -1.0))))) - 4.5; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 9e-112], N[(t$95$0 + -1.5), $MachinePrecision], If[LessEqual[r, 7e+158], N[(t$95$0 + N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(3.0 + N[(N[(w * N[(r * N[(0.375 + N[(v * -0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r / N[(v + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 9 \cdot 10^{-112}:\\
\;\;\;\;t\_0 + -1.5\\
\mathbf{elif}\;r \leq 7 \cdot 10^{+158}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3 + \left(w \cdot \left(r \cdot \left(0.375 + v \cdot -0.25\right)\right)\right) \cdot \left(w \cdot \frac{r}{v + -1}\right)\right) - 4.5\\
\end{array}
\end{array}
if r < 9.00000000000000024e-112Initial program 79.9%
Simplified81.1%
Taylor expanded in v around inf 78.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in r around 0 65.1%
if 9.00000000000000024e-112 < r < 7.0000000000000003e158Initial program 93.1%
Simplified94.8%
Taylor expanded in v around 0 81.0%
Taylor expanded in v around 0 84.7%
if 7.0000000000000003e158 < r Initial program 89.1%
Taylor expanded in r around inf 89.1%
Applied egg-rr93.8%
Final simplification72.8%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) (+ -1.5 (/ (+ 0.375 (* v -0.25)) (* (/ (- 1.0 v) (* r w)) (/ -1.0 (* r w)))))))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * (-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) + ((0.375d0 + (v * (-0.25d0))) / (((1.0d0 - v) / (r * w)) * ((-1.0d0) / (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)) / (((1.0 - v) / (r * w)) * (-1.0 / (r * w)))));
}
def code(v, w, r): return (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * (-1.0 / (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(Float64(1.0 - v) / Float64(r * w)) * Float64(-1.0 / Float64(r * w)))))) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + (-1.5 + ((0.375 + (v * -0.25)) / (((1.0 - v) / (r * w)) * (-1.0 / (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[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / 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{1 - v}{r \cdot w} \cdot \frac{-1}{r \cdot w}}\right)
\end{array}
Initial program 83.9%
Simplified85.4%
*-commutative85.4%
fma-undefine85.4%
*-commutative85.4%
+-commutative85.4%
metadata-eval85.4%
cancel-sign-sub-inv85.4%
associate-*r/85.4%
*-commutative85.4%
associate-/l*85.8%
*-commutative85.8%
clear-num85.8%
un-div-inv85.8%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.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)) (/ (/ (+ 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(Float64(v + -1.0) / 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[(N[(v + -1.0), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + \left(-1.5 + \frac{0.375 + v \cdot -0.25}{\frac{\frac{v + -1}{r \cdot w}}{r \cdot w}}\right)
\end{array}
Initial program 83.9%
Simplified85.4%
*-commutative85.4%
fma-undefine85.4%
*-commutative85.4%
+-commutative85.4%
metadata-eval85.4%
cancel-sign-sub-inv85.4%
associate-*r/85.4%
*-commutative85.4%
associate-/l*85.8%
*-commutative85.8%
clear-num85.8%
un-div-inv85.8%
Applied egg-rr99.8%
*-un-lft-identity99.8%
unpow299.8%
times-frac99.8%
Applied egg-rr99.8%
associate-*l/99.8%
*-un-lft-identity99.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)) (/ (+ 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 83.9%
Simplified85.4%
*-commutative85.4%
fma-undefine85.4%
*-commutative85.4%
+-commutative85.4%
metadata-eval85.4%
cancel-sign-sub-inv85.4%
associate-*r/85.4%
*-commutative85.4%
associate-/l*85.8%
*-commutative85.8%
clear-num85.8%
un-div-inv85.8%
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))))
(if (<= r 1e-111)
(+ t_0 -1.5)
(+ t_0 (- -1.5 (* 0.375 (* r (* r (* w w)))))))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 1e-111) {
tmp = t_0 + -1.5;
} else {
tmp = t_0 + (-1.5 - (0.375 * (r * (r * (w * w)))));
}
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 (r <= 1d-111) then
tmp = t_0 + (-1.5d0)
else
tmp = t_0 + ((-1.5d0) - (0.375d0 * (r * (r * (w * w)))))
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 (r <= 1e-111) {
tmp = t_0 + -1.5;
} else {
tmp = t_0 + (-1.5 - (0.375 * (r * (r * (w * w)))));
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 1e-111: tmp = t_0 + -1.5 else: tmp = t_0 + (-1.5 - (0.375 * (r * (r * (w * w))))) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 1e-111) tmp = Float64(t_0 + -1.5); else tmp = Float64(t_0 + Float64(-1.5 - Float64(0.375 * Float64(r * Float64(r * Float64(w * w)))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 1e-111) tmp = t_0 + -1.5; else tmp = t_0 + (-1.5 - (0.375 * (r * (r * (w * w))))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 1e-111], N[(t$95$0 + -1.5), $MachinePrecision], N[(t$95$0 + N[(-1.5 - N[(0.375 * N[(r * N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 10^{-111}:\\
\;\;\;\;t\_0 + -1.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \left(-1.5 - 0.375 \cdot \left(r \cdot \left(r \cdot \left(w \cdot w\right)\right)\right)\right)\\
\end{array}
\end{array}
if r < 1.00000000000000009e-111Initial program 79.9%
Simplified81.1%
Taylor expanded in v around inf 78.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in r around 0 65.1%
if 1.00000000000000009e-111 < r Initial program 91.7%
Simplified93.8%
Taylor expanded in v around 0 75.0%
Taylor expanded in v around 0 84.6%
Final simplification71.7%
(FPCore (v w r) :precision binary64 (+ (/ 2.0 (* r r)) -1.5))
double code(double v, double w, double r) {
return (2.0 / (r * r)) + -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 = (2.0d0 / (r * r)) + (-1.5d0)
end function
public static double code(double v, double w, double r) {
return (2.0 / (r * r)) + -1.5;
}
def code(v, w, r): return (2.0 / (r * r)) + -1.5
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) + -1.5) end
function tmp = code(v, w, r) tmp = (2.0 / (r * r)) + -1.5; end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{r \cdot r} + -1.5
\end{array}
Initial program 83.9%
Simplified85.4%
Taylor expanded in v around inf 79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in r around 0 56.7%
(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 83.9%
Simplified85.4%
Taylor expanded in v around inf 79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in r around 0 56.7%
Taylor expanded in r around inf 12.9%
herbie shell --seed 2024186
(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))