
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
real(8) function code(v, w, r)
real(8), intent (in) :: v
real(8), intent (in) :: w
real(8), intent (in) :: r
code = ((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w * w) * r) * r)) / Float64(1.0 - v))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w * w), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w \cdot w\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5
\end{array}
(FPCore (v w r) :precision binary64 (- (+ (/ 2.0 (* r r)) -1.5) (* (* (* r w) (/ (* r w) (- 1.0 v))) (fma v -0.25 0.375))))
double code(double v, double w, double r) {
return ((2.0 / (r * r)) + -1.5) - (((r * w) * ((r * w) / (1.0 - v))) * fma(v, -0.25, 0.375));
}
function code(v, w, r) return Float64(Float64(Float64(2.0 / Float64(r * r)) + -1.5) - Float64(Float64(Float64(r * w) * Float64(Float64(r * w) / Float64(1.0 - v))) * fma(v, -0.25, 0.375))) end
code[v_, w_, r_] := N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision] - N[(N[(N[(r * w), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(v * -0.25 + 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{2}{r \cdot r} + -1.5\right) - \left(\left(r \cdot w\right) \cdot \frac{r \cdot w}{1 - v}\right) \cdot \mathsf{fma}\left(v, -0.25, 0.375\right)
\end{array}
Initial program 80.4%
Simplified96.1%
associate-*r*99.8%
*-un-lft-identity99.8%
times-frac99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (- (+ (/ 2.0 (* r r)) -1.5) (* (fma v -0.25 0.375) (/ (* r w) (/ (- 1.0 v) (* r w))))))
double code(double v, double w, double r) {
return ((2.0 / (r * r)) + -1.5) - (fma(v, -0.25, 0.375) * ((r * w) / ((1.0 - v) / (r * w))));
}
function code(v, w, r) return Float64(Float64(Float64(2.0 / Float64(r * r)) + -1.5) - Float64(fma(v, -0.25, 0.375) * Float64(Float64(r * w) / Float64(Float64(1.0 - v) / Float64(r * w))))) end
code[v_, w_, r_] := N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision] - N[(N[(v * -0.25 + 0.375), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] / N[(N[(1.0 - v), $MachinePrecision] / N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{2}{r \cdot r} + -1.5\right) - \mathsf{fma}\left(v, -0.25, 0.375\right) \cdot \frac{r \cdot w}{\frac{1 - v}{r \cdot w}}
\end{array}
Initial program 80.4%
Simplified96.1%
associate-*r*99.8%
*-un-lft-identity99.8%
times-frac99.8%
Applied egg-rr99.8%
/-rgt-identity99.8%
clear-num99.8%
un-div-inv99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (v w r) :precision binary64 (+ -1.5 (+ (/ 2.0 (* r r)) (* (/ (+ -0.375 (* v 0.25)) (- 1.0 v)) (pow (* r w) 2.0)))))
double code(double v, double w, double r) {
return -1.5 + ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * pow((r * w), 2.0)));
}
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)) + ((((-0.375d0) + (v * 0.25d0)) / (1.0d0 - v)) * ((r * w) ** 2.0d0)))
end function
public static double code(double v, double w, double r) {
return -1.5 + ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * Math.pow((r * w), 2.0)));
}
def code(v, w, r): return -1.5 + ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * math.pow((r * w), 2.0)))
function code(v, w, r) return Float64(-1.5 + Float64(Float64(2.0 / Float64(r * r)) + Float64(Float64(Float64(-0.375 + Float64(v * 0.25)) / Float64(1.0 - v)) * (Float64(r * w) ^ 2.0)))) end
function tmp = code(v, w, r) tmp = -1.5 + ((2.0 / (r * r)) + (((-0.375 + (v * 0.25)) / (1.0 - v)) * ((r * w) ^ 2.0))); end
code[v_, w_, r_] := N[(-1.5 + N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(-0.375 + N[(v * 0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[Power[N[(r * w), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
-1.5 + \left(\frac{2}{r \cdot r} + \frac{-0.375 + v \cdot 0.25}{1 - v} \cdot {\left(r \cdot w\right)}^{2}\right)
\end{array}
Initial program 80.4%
Simplified83.7%
Taylor expanded in r around 0 76.1%
unpow276.1%
unpow276.1%
swap-sqr99.8%
unpow299.8%
Simplified99.8%
Final simplification99.8%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= r 6e+176)
(+
-1.5
(+ t_0 (* (/ (+ -0.375 (* v 0.25)) (- 1.0 v)) (* w (* r (* r w))))))
(- (+ t_0 -1.5) (/ (* r (* w (* r w))) 4.0)))))
double code(double v, double w, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (r <= 6e+176) {
tmp = -1.5 + (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (w * (r * (r * w)))));
} else {
tmp = (t_0 + -1.5) - ((r * (w * (r * w))) / 4.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) :: tmp
t_0 = 2.0d0 / (r * r)
if (r <= 6d+176) then
tmp = (-1.5d0) + (t_0 + ((((-0.375d0) + (v * 0.25d0)) / (1.0d0 - v)) * (w * (r * (r * w)))))
else
tmp = (t_0 + (-1.5d0)) - ((r * (w * (r * w))) / 4.0d0)
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 <= 6e+176) {
tmp = -1.5 + (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (w * (r * (r * w)))));
} else {
tmp = (t_0 + -1.5) - ((r * (w * (r * w))) / 4.0);
}
return tmp;
}
def code(v, w, r): t_0 = 2.0 / (r * r) tmp = 0 if r <= 6e+176: tmp = -1.5 + (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (w * (r * (r * w))))) else: tmp = (t_0 + -1.5) - ((r * (w * (r * w))) / 4.0) return tmp
function code(v, w, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (r <= 6e+176) tmp = Float64(-1.5 + Float64(t_0 + Float64(Float64(Float64(-0.375 + Float64(v * 0.25)) / Float64(1.0 - v)) * Float64(w * Float64(r * Float64(r * w)))))); else tmp = Float64(Float64(t_0 + -1.5) - Float64(Float64(r * Float64(w * Float64(r * w))) / 4.0)); end return tmp end
function tmp_2 = code(v, w, r) t_0 = 2.0 / (r * r); tmp = 0.0; if (r <= 6e+176) tmp = -1.5 + (t_0 + (((-0.375 + (v * 0.25)) / (1.0 - v)) * (w * (r * (r * w))))); else tmp = (t_0 + -1.5) - ((r * (w * (r * w))) / 4.0); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, 6e+176], N[(-1.5 + N[(t$95$0 + N[(N[(N[(-0.375 + N[(v * 0.25), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(w * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + -1.5), $MachinePrecision] - N[(N[(r * N[(w * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;r \leq 6 \cdot 10^{+176}:\\
\;\;\;\;-1.5 + \left(t_0 + \frac{-0.375 + v \cdot 0.25}{1 - v} \cdot \left(w \cdot \left(r \cdot \left(r \cdot w\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_0 + -1.5\right) - \frac{r \cdot \left(w \cdot \left(r \cdot w\right)\right)}{4}\\
\end{array}
\end{array}
if r < 6e176Initial program 81.2%
Simplified83.7%
Taylor expanded in r around 0 79.8%
unpow279.8%
unpow279.8%
swap-sqr99.8%
unpow299.8%
Simplified99.8%
unpow294.0%
associate-*r*93.9%
Applied egg-rr99.0%
if 6e176 < r Initial program 74.4%
Simplified99.9%
associate-*l/87.3%
associate-/l*99.9%
associate-*r*99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in v around inf 91.8%
unpow275.1%
*-commutative75.1%
associate-*r*75.2%
Applied egg-rr91.9%
Final simplification98.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ (/ 2.0 (* r r)) -1.5)))
(if (or (<= v -2.8e-41) (not (<= v 1.4e-67)))
(- t_0 (/ (* (* r w) (* r w)) 4.0))
(- t_0 (* 0.375 (* w (/ (* r w) (/ 1.0 r))))))))
double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + -1.5;
double tmp;
if ((v <= -2.8e-41) || !(v <= 1.4e-67)) {
tmp = t_0 - (((r * w) * (r * w)) / 4.0);
} else {
tmp = t_0 - (0.375 * (w * ((r * w) / (1.0 / r))));
}
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)) + (-1.5d0)
if ((v <= (-2.8d-41)) .or. (.not. (v <= 1.4d-67))) then
tmp = t_0 - (((r * w) * (r * w)) / 4.0d0)
else
tmp = t_0 - (0.375d0 * (w * ((r * w) / (1.0d0 / r))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + -1.5;
double tmp;
if ((v <= -2.8e-41) || !(v <= 1.4e-67)) {
tmp = t_0 - (((r * w) * (r * w)) / 4.0);
} else {
tmp = t_0 - (0.375 * (w * ((r * w) / (1.0 / r))));
}
return tmp;
}
def code(v, w, r): t_0 = (2.0 / (r * r)) + -1.5 tmp = 0 if (v <= -2.8e-41) or not (v <= 1.4e-67): tmp = t_0 - (((r * w) * (r * w)) / 4.0) else: tmp = t_0 - (0.375 * (w * ((r * w) / (1.0 / r)))) return tmp
function code(v, w, r) t_0 = Float64(Float64(2.0 / Float64(r * r)) + -1.5) tmp = 0.0 if ((v <= -2.8e-41) || !(v <= 1.4e-67)) tmp = Float64(t_0 - Float64(Float64(Float64(r * w) * Float64(r * w)) / 4.0)); else tmp = Float64(t_0 - Float64(0.375 * Float64(w * Float64(Float64(r * w) / Float64(1.0 / r))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (2.0 / (r * r)) + -1.5; tmp = 0.0; if ((v <= -2.8e-41) || ~((v <= 1.4e-67))) tmp = t_0 - (((r * w) * (r * w)) / 4.0); else tmp = t_0 - (0.375 * (w * ((r * w) / (1.0 / r)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]}, If[Or[LessEqual[v, -2.8e-41], N[Not[LessEqual[v, 1.4e-67]], $MachinePrecision]], N[(t$95$0 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(0.375 * N[(w * N[(N[(r * w), $MachinePrecision] / N[(1.0 / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r} + -1.5\\
\mathbf{if}\;v \leq -2.8 \cdot 10^{-41} \lor \neg \left(v \leq 1.4 \cdot 10^{-67}\right):\\
\;\;\;\;t_0 - \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{4}\\
\mathbf{else}:\\
\;\;\;\;t_0 - 0.375 \cdot \left(w \cdot \frac{r \cdot w}{\frac{1}{r}}\right)\\
\end{array}
\end{array}
if v < -2.8000000000000002e-41 or 1.40000000000000005e-67 < v Initial program 78.5%
Simplified98.0%
associate-*l/88.5%
associate-/l*98.0%
associate-*r*99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 99.0%
unpow299.0%
Applied egg-rr99.0%
if -2.8000000000000002e-41 < v < 1.40000000000000005e-67Initial program 83.5%
Simplified92.7%
Taylor expanded in v around 0 75.3%
*-commutative75.3%
unpow275.3%
unpow275.3%
swap-sqr99.8%
unpow299.8%
Simplified99.8%
unpow299.8%
associate-*r*97.9%
Applied egg-rr97.9%
*-commutative97.9%
/-rgt-identity97.9%
clear-num97.9%
div-inv97.9%
clear-num97.9%
div-inv97.9%
div-inv97.8%
associate-/r*97.9%
div-inv97.9%
clear-num97.9%
/-rgt-identity97.9%
Applied egg-rr97.9%
Final simplification98.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ (/ 2.0 (* r r)) -1.5)))
(if (or (<= v -4e+30) (not (<= v 5e-67)))
(- t_0 (/ (* (* r w) (* r w)) 4.0))
(- t_0 (* 0.375 (/ (* r w) (/ (/ 1.0 w) r)))))))
double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + -1.5;
double tmp;
if ((v <= -4e+30) || !(v <= 5e-67)) {
tmp = t_0 - (((r * w) * (r * w)) / 4.0);
} else {
tmp = t_0 - (0.375 * ((r * w) / ((1.0 / w) / r)));
}
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)) + (-1.5d0)
if ((v <= (-4d+30)) .or. (.not. (v <= 5d-67))) then
tmp = t_0 - (((r * w) * (r * w)) / 4.0d0)
else
tmp = t_0 - (0.375d0 * ((r * w) / ((1.0d0 / w) / r)))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + -1.5;
double tmp;
if ((v <= -4e+30) || !(v <= 5e-67)) {
tmp = t_0 - (((r * w) * (r * w)) / 4.0);
} else {
tmp = t_0 - (0.375 * ((r * w) / ((1.0 / w) / r)));
}
return tmp;
}
def code(v, w, r): t_0 = (2.0 / (r * r)) + -1.5 tmp = 0 if (v <= -4e+30) or not (v <= 5e-67): tmp = t_0 - (((r * w) * (r * w)) / 4.0) else: tmp = t_0 - (0.375 * ((r * w) / ((1.0 / w) / r))) return tmp
function code(v, w, r) t_0 = Float64(Float64(2.0 / Float64(r * r)) + -1.5) tmp = 0.0 if ((v <= -4e+30) || !(v <= 5e-67)) tmp = Float64(t_0 - Float64(Float64(Float64(r * w) * Float64(r * w)) / 4.0)); else tmp = Float64(t_0 - Float64(0.375 * Float64(Float64(r * w) / Float64(Float64(1.0 / w) / r)))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (2.0 / (r * r)) + -1.5; tmp = 0.0; if ((v <= -4e+30) || ~((v <= 5e-67))) tmp = t_0 - (((r * w) * (r * w)) / 4.0); else tmp = t_0 - (0.375 * ((r * w) / ((1.0 / w) / r))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]}, If[Or[LessEqual[v, -4e+30], N[Not[LessEqual[v, 5e-67]], $MachinePrecision]], N[(t$95$0 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(0.375 * N[(N[(r * w), $MachinePrecision] / N[(N[(1.0 / w), $MachinePrecision] / r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r} + -1.5\\
\mathbf{if}\;v \leq -4 \cdot 10^{+30} \lor \neg \left(v \leq 5 \cdot 10^{-67}\right):\\
\;\;\;\;t_0 - \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{4}\\
\mathbf{else}:\\
\;\;\;\;t_0 - 0.375 \cdot \frac{r \cdot w}{\frac{\frac{1}{w}}{r}}\\
\end{array}
\end{array}
if v < -4.0000000000000001e30 or 4.9999999999999999e-67 < v Initial program 77.2%
Simplified97.8%
associate-*l/87.1%
associate-/l*97.8%
associate-*r*99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 99.4%
unpow299.4%
Applied egg-rr99.4%
if -4.0000000000000001e30 < v < 4.9999999999999999e-67Initial program 84.3%
Simplified93.9%
Taylor expanded in v around 0 75.8%
*-commutative75.8%
unpow275.8%
unpow275.8%
swap-sqr99.8%
unpow299.8%
Simplified99.8%
unpow299.8%
remove-double-div99.8%
un-div-inv99.8%
*-commutative99.8%
associate-/r*99.8%
Applied egg-rr99.8%
Final simplification99.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ (/ 2.0 (* r r)) -1.5)))
(if (or (<= v -2.9e+30) (not (<= v 5e-67)))
(- t_0 (/ (* (* r w) (* r w)) 4.0))
(- t_0 (/ (* r w) (/ (/ (/ 1.0 r) w) 0.375))))))
double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + -1.5;
double tmp;
if ((v <= -2.9e+30) || !(v <= 5e-67)) {
tmp = t_0 - (((r * w) * (r * w)) / 4.0);
} else {
tmp = t_0 - ((r * w) / (((1.0 / r) / w) / 0.375));
}
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)) + (-1.5d0)
if ((v <= (-2.9d+30)) .or. (.not. (v <= 5d-67))) then
tmp = t_0 - (((r * w) * (r * w)) / 4.0d0)
else
tmp = t_0 - ((r * w) / (((1.0d0 / r) / w) / 0.375d0))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + -1.5;
double tmp;
if ((v <= -2.9e+30) || !(v <= 5e-67)) {
tmp = t_0 - (((r * w) * (r * w)) / 4.0);
} else {
tmp = t_0 - ((r * w) / (((1.0 / r) / w) / 0.375));
}
return tmp;
}
def code(v, w, r): t_0 = (2.0 / (r * r)) + -1.5 tmp = 0 if (v <= -2.9e+30) or not (v <= 5e-67): tmp = t_0 - (((r * w) * (r * w)) / 4.0) else: tmp = t_0 - ((r * w) / (((1.0 / r) / w) / 0.375)) return tmp
function code(v, w, r) t_0 = Float64(Float64(2.0 / Float64(r * r)) + -1.5) tmp = 0.0 if ((v <= -2.9e+30) || !(v <= 5e-67)) tmp = Float64(t_0 - Float64(Float64(Float64(r * w) * Float64(r * w)) / 4.0)); else tmp = Float64(t_0 - Float64(Float64(r * w) / Float64(Float64(Float64(1.0 / r) / w) / 0.375))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (2.0 / (r * r)) + -1.5; tmp = 0.0; if ((v <= -2.9e+30) || ~((v <= 5e-67))) tmp = t_0 - (((r * w) * (r * w)) / 4.0); else tmp = t_0 - ((r * w) / (((1.0 / r) / w) / 0.375)); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]}, If[Or[LessEqual[v, -2.9e+30], N[Not[LessEqual[v, 5e-67]], $MachinePrecision]], N[(t$95$0 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(N[(r * w), $MachinePrecision] / N[(N[(N[(1.0 / r), $MachinePrecision] / w), $MachinePrecision] / 0.375), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r} + -1.5\\
\mathbf{if}\;v \leq -2.9 \cdot 10^{+30} \lor \neg \left(v \leq 5 \cdot 10^{-67}\right):\\
\;\;\;\;t_0 - \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{4}\\
\mathbf{else}:\\
\;\;\;\;t_0 - \frac{r \cdot w}{\frac{\frac{\frac{1}{r}}{w}}{0.375}}\\
\end{array}
\end{array}
if v < -2.8999999999999998e30 or 4.9999999999999999e-67 < v Initial program 77.2%
Simplified97.8%
associate-*l/87.1%
associate-/l*97.8%
associate-*r*99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 99.4%
unpow299.4%
Applied egg-rr99.4%
if -2.8999999999999998e30 < v < 4.9999999999999999e-67Initial program 84.3%
Simplified93.9%
Taylor expanded in v around 0 75.8%
*-commutative75.8%
unpow275.8%
unpow275.8%
swap-sqr99.8%
unpow299.8%
Simplified99.8%
unpow299.8%
*-commutative99.8%
associate-*r*93.9%
Applied egg-rr93.9%
associate-*l*99.8%
*-commutative99.8%
remove-double-div99.8%
associate-/l/99.8%
div-inv99.8%
associate-*l/99.8%
associate-/l*99.9%
associate-/l/99.8%
associate-/r*99.9%
Applied egg-rr99.9%
Final simplification99.6%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ (/ 2.0 (* r r)) -1.5)))
(if (or (<= v -7.5e-43) (not (<= v 6.6e-67)))
(- t_0 (/ (* (* r w) (* r w)) 4.0))
(- t_0 (* 0.375 (* w (* r (* r w))))))))
double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + -1.5;
double tmp;
if ((v <= -7.5e-43) || !(v <= 6.6e-67)) {
tmp = t_0 - (((r * w) * (r * w)) / 4.0);
} else {
tmp = t_0 - (0.375 * (w * (r * (r * 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)) + (-1.5d0)
if ((v <= (-7.5d-43)) .or. (.not. (v <= 6.6d-67))) then
tmp = t_0 - (((r * w) * (r * w)) / 4.0d0)
else
tmp = t_0 - (0.375d0 * (w * (r * (r * w))))
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = (2.0 / (r * r)) + -1.5;
double tmp;
if ((v <= -7.5e-43) || !(v <= 6.6e-67)) {
tmp = t_0 - (((r * w) * (r * w)) / 4.0);
} else {
tmp = t_0 - (0.375 * (w * (r * (r * w))));
}
return tmp;
}
def code(v, w, r): t_0 = (2.0 / (r * r)) + -1.5 tmp = 0 if (v <= -7.5e-43) or not (v <= 6.6e-67): tmp = t_0 - (((r * w) * (r * w)) / 4.0) else: tmp = t_0 - (0.375 * (w * (r * (r * w)))) return tmp
function code(v, w, r) t_0 = Float64(Float64(2.0 / Float64(r * r)) + -1.5) tmp = 0.0 if ((v <= -7.5e-43) || !(v <= 6.6e-67)) tmp = Float64(t_0 - Float64(Float64(Float64(r * w) * Float64(r * w)) / 4.0)); else tmp = Float64(t_0 - Float64(0.375 * Float64(w * Float64(r * Float64(r * w))))); end return tmp end
function tmp_2 = code(v, w, r) t_0 = (2.0 / (r * r)) + -1.5; tmp = 0.0; if ((v <= -7.5e-43) || ~((v <= 6.6e-67))) tmp = t_0 - (((r * w) * (r * w)) / 4.0); else tmp = t_0 - (0.375 * (w * (r * (r * w)))); end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision]}, If[Or[LessEqual[v, -7.5e-43], N[Not[LessEqual[v, 6.6e-67]], $MachinePrecision]], N[(t$95$0 - N[(N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision] / 4.0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(0.375 * N[(w * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r} + -1.5\\
\mathbf{if}\;v \leq -7.5 \cdot 10^{-43} \lor \neg \left(v \leq 6.6 \cdot 10^{-67}\right):\\
\;\;\;\;t_0 - \frac{\left(r \cdot w\right) \cdot \left(r \cdot w\right)}{4}\\
\mathbf{else}:\\
\;\;\;\;t_0 - 0.375 \cdot \left(w \cdot \left(r \cdot \left(r \cdot w\right)\right)\right)\\
\end{array}
\end{array}
if v < -7.50000000000000068e-43 or 6.6000000000000003e-67 < v Initial program 78.5%
Simplified98.0%
associate-*l/88.5%
associate-/l*98.0%
associate-*r*99.8%
pow299.8%
Applied egg-rr99.8%
Taylor expanded in v around inf 99.0%
unpow299.0%
Applied egg-rr99.0%
if -7.50000000000000068e-43 < v < 6.6000000000000003e-67Initial program 83.5%
Simplified92.7%
Taylor expanded in v around 0 75.3%
*-commutative75.3%
unpow275.3%
unpow275.3%
swap-sqr99.8%
unpow299.8%
Simplified99.8%
unpow299.8%
associate-*r*97.9%
Applied egg-rr97.9%
Final simplification98.6%
(FPCore (v w r) :precision binary64 (- (+ (/ 2.0 (* r r)) -1.5) (* 0.375 (* w (* r (* r w))))))
double code(double v, double w, double r) {
return ((2.0 / (r * r)) + -1.5) - (0.375 * (w * (r * (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 * (w * (r * (r * w))))
end function
public static double code(double v, double w, double r) {
return ((2.0 / (r * r)) + -1.5) - (0.375 * (w * (r * (r * w))));
}
def code(v, w, r): return ((2.0 / (r * r)) + -1.5) - (0.375 * (w * (r * (r * w))))
function code(v, w, r) return Float64(Float64(Float64(2.0 / Float64(r * r)) + -1.5) - Float64(0.375 * Float64(w * Float64(r * Float64(r * w))))) end
function tmp = code(v, w, r) tmp = ((2.0 / (r * r)) + -1.5) - (0.375 * (w * (r * (r * w)))); end
code[v_, w_, r_] := N[(N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] + -1.5), $MachinePrecision] - N[(0.375 * N[(w * N[(r * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{2}{r \cdot r} + -1.5\right) - 0.375 \cdot \left(w \cdot \left(r \cdot \left(r \cdot w\right)\right)\right)
\end{array}
Initial program 80.4%
Simplified96.1%
Taylor expanded in v around 0 73.0%
*-commutative73.0%
unpow273.0%
unpow273.0%
swap-sqr91.8%
unpow291.8%
Simplified91.8%
unpow291.8%
associate-*r*90.4%
Applied egg-rr90.4%
Final simplification90.4%
herbie shell --seed 2023320
(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))