(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))
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ (fma v -0.25 0.375) (- 1.0 v))) (t_1 (* 2.0 (pow r -2.0))))
(if (<= r -1.391648850866366e-38)
(- t_1 (fma r (* (* r (* w w)) t_0) 1.5))
(if (<= r -4.72196167779232e-154)
(- t_1 1.5)
(- t_1 (fma r (pow (* w (sqrt (* r t_0))) 2.0) 1.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;
}
double code(double v, double w, double r) {
double t_0 = fma(v, -0.25, 0.375) / (1.0 - v);
double t_1 = 2.0 * pow(r, -2.0);
double tmp;
if (r <= -1.391648850866366e-38) {
tmp = t_1 - fma(r, ((r * (w * w)) * t_0), 1.5);
} else if (r <= -4.72196167779232e-154) {
tmp = t_1 - 1.5;
} else {
tmp = t_1 - fma(r, pow((w * sqrt((r * t_0))), 2.0), 1.5);
}
return tmp;
}
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 code(v, w, r) t_0 = Float64(fma(v, -0.25, 0.375) / Float64(1.0 - v)) t_1 = Float64(2.0 * (r ^ -2.0)) tmp = 0.0 if (r <= -1.391648850866366e-38) tmp = Float64(t_1 - fma(r, Float64(Float64(r * Float64(w * w)) * t_0), 1.5)); elseif (r <= -4.72196167779232e-154) tmp = Float64(t_1 - 1.5); else tmp = Float64(t_1 - fma(r, (Float64(w * sqrt(Float64(r * t_0))) ^ 2.0), 1.5)); end return tmp 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]
code[v_, w_, r_] := Block[{t$95$0 = N[(N[(v * -0.25 + 0.375), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[Power[r, -2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[r, -1.391648850866366e-38], N[(t$95$1 - N[(r * N[(N[(r * N[(w * w), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[r, -4.72196167779232e-154], N[(t$95$1 - 1.5), $MachinePrecision], N[(t$95$1 - N[(r * N[Power[N[(w * N[Sqrt[N[(r * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision]]]]]
\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
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(v, -0.25, 0.375\right)}{1 - v}\\
t_1 := 2 \cdot {r}^{-2}\\
\mathbf{if}\;r \leq -1.391648850866366 \cdot 10^{-38}:\\
\;\;\;\;t_1 - \mathsf{fma}\left(r, \left(r \cdot \left(w \cdot w\right)\right) \cdot t_0, 1.5\right)\\
\mathbf{elif}\;r \leq -4.72196167779232 \cdot 10^{-154}:\\
\;\;\;\;t_1 - 1.5\\
\mathbf{else}:\\
\;\;\;\;t_1 - \mathsf{fma}\left(r, {\left(w \cdot \sqrt{r \cdot t_0}\right)}^{2}, 1.5\right)\\
\end{array}



Bits error versus v



Bits error versus w



Bits error versus r
if r < -1.39164885086636609e-38Initial program 13.4
Simplified6.6
Applied egg-rr6.6
Taylor expanded in r around 0 6.6
Simplified6.6
if -1.39164885086636609e-38 < r < -4.72196167779231994e-154Initial program 12.4
Simplified11.7
Applied egg-rr11.5
Taylor expanded in r around 0 6.4
if -4.72196167779231994e-154 < r Initial program 11.9
Simplified7.8
Applied egg-rr7.7
Taylor expanded in r around 0 7.7
Simplified7.7
Applied egg-rr2.3
Final simplification4.4
herbie shell --seed 2022134
(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))