
(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;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
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]
\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
Herbie found 14 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;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
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]
\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
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* (fabs w) r)) (t_1 (/ 2.0 (* r r))) (t_2 (/ r (- 1.0 v))))
(if (<= (fabs w) 0.2)
(-
t_1
(fma (* t_2 (fma -0.25 (* v (fabs w)) (* 0.375 (fabs w)))) t_0 1.5))
(-
(fma (fabs w) (* (* (fma -2.0 v 3.0) 0.125) (* t_2 t_0)) (- 1.5 t_1))))))double code(double v, double w, double r) {
double t_0 = fabs(w) * r;
double t_1 = 2.0 / (r * r);
double t_2 = r / (1.0 - v);
double tmp;
if (fabs(w) <= 0.2) {
tmp = t_1 - fma((t_2 * fma(-0.25, (v * fabs(w)), (0.375 * fabs(w)))), t_0, 1.5);
} else {
tmp = -fma(fabs(w), ((fma(-2.0, v, 3.0) * 0.125) * (t_2 * t_0)), (1.5 - t_1));
}
return tmp;
}
function code(v, w, r) t_0 = Float64(abs(w) * r) t_1 = Float64(2.0 / Float64(r * r)) t_2 = Float64(r / Float64(1.0 - v)) tmp = 0.0 if (abs(w) <= 0.2) tmp = Float64(t_1 - fma(Float64(t_2 * fma(-0.25, Float64(v * abs(w)), Float64(0.375 * abs(w)))), t_0, 1.5)); else tmp = Float64(-fma(abs(w), Float64(Float64(fma(-2.0, v, 3.0) * 0.125) * Float64(t_2 * t_0)), Float64(1.5 - t_1))); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(N[Abs[w], $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[w], $MachinePrecision], 0.2], N[(t$95$1 - N[(N[(t$95$2 * N[(-0.25 * N[(v * N[Abs[w], $MachinePrecision]), $MachinePrecision] + N[(0.375 * N[Abs[w], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0 + 1.5), $MachinePrecision]), $MachinePrecision], (-N[(N[Abs[w], $MachinePrecision] * N[(N[(N[(-2.0 * v + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] * N[(t$95$2 * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(1.5 - t$95$1), $MachinePrecision]), $MachinePrecision])]]]]
\begin{array}{l}
t_0 := \left|w\right| \cdot r\\
t_1 := \frac{2}{r \cdot r}\\
t_2 := \frac{r}{1 - v}\\
\mathbf{if}\;\left|w\right| \leq 0.2:\\
\;\;\;\;t\_1 - \mathsf{fma}\left(t\_2 \cdot \mathsf{fma}\left(-0.25, v \cdot \left|w\right|, 0.375 \cdot \left|w\right|\right), t\_0, 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(\left|w\right|, \left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125\right) \cdot \left(t\_2 \cdot t\_0\right), 1.5 - t\_1\right)\\
\end{array}
if w < 0.20000000000000001Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
Taylor expanded in v around 0
lower-*.f6481.1%
Applied rewrites81.1%
lift-neg.f64N/A
lift--.f64N/A
sub-negateN/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites82.6%
Taylor expanded in v around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
if 0.20000000000000001 < w Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.5%
(FPCore (v w r) :precision binary64 (- (fma (* (* (* (/ r (- 1.0 v)) 0.125) (fma -2.0 v 3.0)) w) (* w r) (- 1.5 (/ 2.0 (* r r))))))
double code(double v, double w, double r) {
return -fma(((((r / (1.0 - v)) * 0.125) * fma(-2.0, v, 3.0)) * w), (w * r), (1.5 - (2.0 / (r * r))));
}
function code(v, w, r) return Float64(-fma(Float64(Float64(Float64(Float64(r / Float64(1.0 - v)) * 0.125) * fma(-2.0, v, 3.0)) * w), Float64(w * r), Float64(1.5 - Float64(2.0 / Float64(r * r))))) end
code[v_, w_, r_] := (-N[(N[(N[(N[(N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * 0.125), $MachinePrecision] * N[(-2.0 * v + 3.0), $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * N[(w * r), $MachinePrecision] + N[(1.5 - N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])
-\mathsf{fma}\left(\left(\left(\frac{r}{1 - v} \cdot 0.125\right) \cdot \mathsf{fma}\left(-2, v, 3\right)\right) \cdot w, w \cdot r, 1.5 - \frac{2}{r \cdot r}\right)
Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.7%
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.4%
Applied rewrites99.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (- 1.5 (/ 2.0 (* r r))))
(t_1 (- (fma (* 0.25 r) (* (* w r) w) t_0))))
(if (<= v -3.1e+95)
t_1
(if (<= v 3e-44) (- (fma (* (* 0.375 r) w) (* w r) t_0)) t_1))))double code(double v, double w, double r) {
double t_0 = 1.5 - (2.0 / (r * r));
double t_1 = -fma((0.25 * r), ((w * r) * w), t_0);
double tmp;
if (v <= -3.1e+95) {
tmp = t_1;
} else if (v <= 3e-44) {
tmp = -fma(((0.375 * r) * w), (w * r), t_0);
} else {
tmp = t_1;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(1.5 - Float64(2.0 / Float64(r * r))) t_1 = Float64(-fma(Float64(0.25 * r), Float64(Float64(w * r) * w), t_0)) tmp = 0.0 if (v <= -3.1e+95) tmp = t_1; elseif (v <= 3e-44) tmp = Float64(-fma(Float64(Float64(0.375 * r) * w), Float64(w * r), t_0)); else tmp = t_1; end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(1.5 - N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[(N[(0.25 * r), $MachinePrecision] * N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] + t$95$0), $MachinePrecision])}, If[LessEqual[v, -3.1e+95], t$95$1, If[LessEqual[v, 3e-44], (-N[(N[(N[(0.375 * r), $MachinePrecision] * w), $MachinePrecision] * N[(w * r), $MachinePrecision] + t$95$0), $MachinePrecision]), t$95$1]]]]
\begin{array}{l}
t_0 := 1.5 - \frac{2}{r \cdot r}\\
t_1 := -\mathsf{fma}\left(0.25 \cdot r, \left(w \cdot r\right) \cdot w, t\_0\right)\\
\mathbf{if}\;v \leq -3.1 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;v \leq 3 \cdot 10^{-44}:\\
\;\;\;\;-\mathsf{fma}\left(\left(0.375 \cdot r\right) \cdot w, w \cdot r, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if v < -3.1000000000000003e95 or 3.0000000000000002e-44 < v Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.7%
Taylor expanded in v around inf
lower-*.f6491.0%
Applied rewrites91.0%
if -3.1000000000000003e95 < v < 3.0000000000000002e-44Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.7%
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.4%
Applied rewrites99.4%
Taylor expanded in v around 0
lower-*.f6493.5%
Applied rewrites93.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (- 1.5 (/ 2.0 (* r r))))
(t_1 (- (fma (* 0.25 r) (* (* w r) w) t_0))))
(if (<= v -3.1e+95)
t_1
(if (<= v 3e-44) (- (fma (* 0.375 (* r w)) (* w r) t_0)) t_1))))double code(double v, double w, double r) {
double t_0 = 1.5 - (2.0 / (r * r));
double t_1 = -fma((0.25 * r), ((w * r) * w), t_0);
double tmp;
if (v <= -3.1e+95) {
tmp = t_1;
} else if (v <= 3e-44) {
tmp = -fma((0.375 * (r * w)), (w * r), t_0);
} else {
tmp = t_1;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(1.5 - Float64(2.0 / Float64(r * r))) t_1 = Float64(-fma(Float64(0.25 * r), Float64(Float64(w * r) * w), t_0)) tmp = 0.0 if (v <= -3.1e+95) tmp = t_1; elseif (v <= 3e-44) tmp = Float64(-fma(Float64(0.375 * Float64(r * w)), Float64(w * r), t_0)); else tmp = t_1; end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(1.5 - N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[(N[(0.25 * r), $MachinePrecision] * N[(N[(w * r), $MachinePrecision] * w), $MachinePrecision] + t$95$0), $MachinePrecision])}, If[LessEqual[v, -3.1e+95], t$95$1, If[LessEqual[v, 3e-44], (-N[(N[(0.375 * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision] + t$95$0), $MachinePrecision]), t$95$1]]]]
\begin{array}{l}
t_0 := 1.5 - \frac{2}{r \cdot r}\\
t_1 := -\mathsf{fma}\left(0.25 \cdot r, \left(w \cdot r\right) \cdot w, t\_0\right)\\
\mathbf{if}\;v \leq -3.1 \cdot 10^{+95}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;v \leq 3 \cdot 10^{-44}:\\
\;\;\;\;-\mathsf{fma}\left(0.375 \cdot \left(r \cdot w\right), w \cdot r, t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
if v < -3.1000000000000003e95 or 3.0000000000000002e-44 < v Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.7%
Taylor expanded in v around inf
lower-*.f6491.0%
Applied rewrites91.0%
if -3.1000000000000003e95 < v < 3.0000000000000002e-44Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.7%
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.4%
Applied rewrites99.4%
Taylor expanded in v around 0
lower-*.f64N/A
lower-*.f6493.4%
Applied rewrites93.4%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (/ 2.0 (* (fabs r) (fabs r)))) (t_1 (* w (fabs r))))
(if (<= (fabs r) 1.4e-57)
(- (fma (* (* 0.375 (fabs r)) w) t_1 (- 1.5 t_0)))
(-
t_0
(fma
(* (/ (fabs r) (- 1.0 v)) (fma -0.25 (* v w) (* 0.375 w)))
t_1
1.5)))))double code(double v, double w, double r) {
double t_0 = 2.0 / (fabs(r) * fabs(r));
double t_1 = w * fabs(r);
double tmp;
if (fabs(r) <= 1.4e-57) {
tmp = -fma(((0.375 * fabs(r)) * w), t_1, (1.5 - t_0));
} else {
tmp = t_0 - fma(((fabs(r) / (1.0 - v)) * fma(-0.25, (v * w), (0.375 * w))), t_1, 1.5);
}
return tmp;
}
function code(v, w, r) t_0 = Float64(2.0 / Float64(abs(r) * abs(r))) t_1 = Float64(w * abs(r)) tmp = 0.0 if (abs(r) <= 1.4e-57) tmp = Float64(-fma(Float64(Float64(0.375 * abs(r)) * w), t_1, Float64(1.5 - t_0))); else tmp = Float64(t_0 - fma(Float64(Float64(abs(r) / Float64(1.0 - v)) * fma(-0.25, Float64(v * w), Float64(0.375 * w))), t_1, 1.5)); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(2.0 / N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(w * N[Abs[r], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[r], $MachinePrecision], 1.4e-57], (-N[(N[(N[(0.375 * N[Abs[r], $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * t$95$1 + N[(1.5 - t$95$0), $MachinePrecision]), $MachinePrecision]), N[(t$95$0 - N[(N[(N[(N[Abs[r], $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(-0.25 * N[(v * w), $MachinePrecision] + N[(0.375 * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1 + 1.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \frac{2}{\left|r\right| \cdot \left|r\right|}\\
t_1 := w \cdot \left|r\right|\\
\mathbf{if}\;\left|r\right| \leq 1.4 \cdot 10^{-57}:\\
\;\;\;\;-\mathsf{fma}\left(\left(0.375 \cdot \left|r\right|\right) \cdot w, t\_1, 1.5 - t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \mathsf{fma}\left(\frac{\left|r\right|}{1 - v} \cdot \mathsf{fma}\left(-0.25, v \cdot w, 0.375 \cdot w\right), t\_1, 1.5\right)\\
\end{array}
if r < 1.4e-57Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.7%
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.4%
Applied rewrites99.4%
Taylor expanded in v around 0
lower-*.f6493.5%
Applied rewrites93.5%
if 1.4e-57 < r Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
Taylor expanded in v around 0
lower-*.f6481.1%
Applied rewrites81.1%
lift-neg.f64N/A
lift--.f64N/A
sub-negateN/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites82.6%
Taylor expanded in v around 0
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f6494.0%
Applied rewrites94.0%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (* w (fabs r))))
(if (<= (fabs r) 68000000.0)
(-
(fma (* (* 0.375 (fabs r)) w) t_0 (- 1.5 (/ 2.0 (* (fabs r) (fabs r))))))
(-
(fma
(* (/ (fabs r) (- 1.0 v)) (* (fma -2.0 v 3.0) 0.125))
(* t_0 w)
1.5)))))double code(double v, double w, double r) {
double t_0 = w * fabs(r);
double tmp;
if (fabs(r) <= 68000000.0) {
tmp = -fma(((0.375 * fabs(r)) * w), t_0, (1.5 - (2.0 / (fabs(r) * fabs(r)))));
} else {
tmp = -fma(((fabs(r) / (1.0 - v)) * (fma(-2.0, v, 3.0) * 0.125)), (t_0 * w), 1.5);
}
return tmp;
}
function code(v, w, r) t_0 = Float64(w * abs(r)) tmp = 0.0 if (abs(r) <= 68000000.0) tmp = Float64(-fma(Float64(Float64(0.375 * abs(r)) * w), t_0, Float64(1.5 - Float64(2.0 / Float64(abs(r) * abs(r)))))); else tmp = Float64(-fma(Float64(Float64(abs(r) / Float64(1.0 - v)) * Float64(fma(-2.0, v, 3.0) * 0.125)), Float64(t_0 * w), 1.5)); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(w * N[Abs[r], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Abs[r], $MachinePrecision], 68000000.0], (-N[(N[(N[(0.375 * N[Abs[r], $MachinePrecision]), $MachinePrecision] * w), $MachinePrecision] * t$95$0 + N[(1.5 - N[(2.0 / N[(N[Abs[r], $MachinePrecision] * N[Abs[r], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), (-N[(N[(N[(N[Abs[r], $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] * N[(N[(-2.0 * v + 3.0), $MachinePrecision] * 0.125), $MachinePrecision]), $MachinePrecision] * N[(t$95$0 * w), $MachinePrecision] + 1.5), $MachinePrecision])]]
\begin{array}{l}
t_0 := w \cdot \left|r\right|\\
\mathbf{if}\;\left|r\right| \leq 68000000:\\
\;\;\;\;-\mathsf{fma}\left(\left(0.375 \cdot \left|r\right|\right) \cdot w, t\_0, 1.5 - \frac{2}{\left|r\right| \cdot \left|r\right|}\right)\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(\frac{\left|r\right|}{1 - v} \cdot \left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125\right), t\_0 \cdot w, 1.5\right)\\
\end{array}
if r < 6.8e7Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.7%
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.4%
Applied rewrites99.4%
Taylor expanded in v around 0
lower-*.f6493.5%
Applied rewrites93.5%
if 6.8e7 < r Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.7%
Taylor expanded in r around inf
Applied rewrites55.2%
(FPCore (v w r) :precision binary64 (- (fma (* 0.375 (* r w)) (* w r) (- 1.5 (/ 2.0 (* r r))))))
double code(double v, double w, double r) {
return -fma((0.375 * (r * w)), (w * r), (1.5 - (2.0 / (r * r))));
}
function code(v, w, r) return Float64(-fma(Float64(0.375 * Float64(r * w)), Float64(w * r), Float64(1.5 - Float64(2.0 / Float64(r * r))))) end
code[v_, w_, r_] := (-N[(N[(0.375 * N[(r * w), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision] + N[(1.5 - N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])
-\mathsf{fma}\left(0.375 \cdot \left(r \cdot w\right), w \cdot r, 1.5 - \frac{2}{r \cdot r}\right)
Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
lift--.f64N/A
lift--.f64N/A
associate--r-N/A
+-commutativeN/A
Applied rewrites96.7%
lift-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.4%
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.4%
Applied rewrites99.4%
Taylor expanded in v around 0
lower-*.f64N/A
lower-*.f6493.4%
Applied rewrites93.4%
(FPCore (v w r) :precision binary64 (- (/ 2.0 (* r r)) (fma (* r (* 0.375 w)) (* w r) 1.5)))
double code(double v, double w, double r) {
return (2.0 / (r * r)) - fma((r * (0.375 * w)), (w * r), 1.5);
}
function code(v, w, r) return Float64(Float64(2.0 / Float64(r * r)) - fma(Float64(r * Float64(0.375 * w)), Float64(w * r), 1.5)) end
code[v_, w_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - N[(N[(r * N[(0.375 * w), $MachinePrecision]), $MachinePrecision] * N[(w * r), $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision]
\frac{2}{r \cdot r} - \mathsf{fma}\left(r \cdot \left(0.375 \cdot w\right), w \cdot r, 1.5\right)
Initial program 84.8%
lift--.f64N/A
sub-negate-revN/A
lower-neg.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
associate--r+N/A
lower--.f64N/A
metadata-evalN/A
lower--.f6484.8%
Applied rewrites91.3%
Taylor expanded in v around 0
lower-*.f6481.1%
Applied rewrites81.1%
lift-neg.f64N/A
lift--.f64N/A
sub-negateN/A
lift--.f64N/A
associate--l-N/A
lower--.f64N/A
Applied rewrites82.6%
Taylor expanded in v around 0
Applied rewrites93.5%
(FPCore (v w r)
:precision binary64
(if (<=
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)
-2e+154)
(* (/ (fma 0.75 (* r r) -1.0) r) (/ -2.0 r))
(- (* 2.0 (pow r -2.0)) 1.5)))double code(double v, double w, double r) {
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+154) {
tmp = (fma(0.75, (r * r), -1.0) / r) * (-2.0 / r);
} else {
tmp = (2.0 * pow(r, -2.0)) - 1.5;
}
return tmp;
}
function code(v, w, r) tmp = 0.0 if (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) <= -2e+154) tmp = Float64(Float64(fma(0.75, Float64(r * r), -1.0) / r) * Float64(-2.0 / r)); else tmp = Float64(Float64(2.0 * (r ^ -2.0)) - 1.5); end return tmp end
code[v_, w_, r_] := If[LessEqual[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], -2e+154], N[(N[(N[(0.75 * N[(r * r), $MachinePrecision] + -1.0), $MachinePrecision] / r), $MachinePrecision] * N[(-2.0 / r), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * N[Power[r, -2.0], $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\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 \leq -2 \cdot 10^{+154}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.75, r \cdot r, -1\right)}{r} \cdot \frac{-2}{r}\\
\mathbf{else}:\\
\;\;\;\;2 \cdot {r}^{-2} - 1.5\\
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -2.0000000000000001e154Initial program 84.8%
Taylor expanded in w around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
mult-flip-revN/A
metadata-evalN/A
frac-subN/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites52.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites69.0%
if -2.0000000000000001e154 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 84.8%
Taylor expanded in w around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6456.6%
Applied rewrites56.6%
lift-/.f64N/A
lift-pow.f64N/A
pow-flipN/A
metadata-evalN/A
lower-pow.f6456.6%
Applied rewrites56.6%
(FPCore (v w r) :precision binary64 (if (<= (fabs w) 4.8e-135) (- (/ (/ 6.0 r) (* 3.0 r)) 1.5) (/ (* (fma -0.75 (* r r) 1.0) (/ 2.0 r)) r)))
double code(double v, double w, double r) {
double tmp;
if (fabs(w) <= 4.8e-135) {
tmp = ((6.0 / r) / (3.0 * r)) - 1.5;
} else {
tmp = (fma(-0.75, (r * r), 1.0) * (2.0 / r)) / r;
}
return tmp;
}
function code(v, w, r) tmp = 0.0 if (abs(w) <= 4.8e-135) tmp = Float64(Float64(Float64(6.0 / r) / Float64(3.0 * r)) - 1.5); else tmp = Float64(Float64(fma(-0.75, Float64(r * r), 1.0) * Float64(2.0 / r)) / r); end return tmp end
code[v_, w_, r_] := If[LessEqual[N[Abs[w], $MachinePrecision], 4.8e-135], N[(N[(N[(6.0 / r), $MachinePrecision] / N[(3.0 * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision], N[(N[(N[(-0.75 * N[(r * r), $MachinePrecision] + 1.0), $MachinePrecision] * N[(2.0 / r), $MachinePrecision]), $MachinePrecision] / r), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\left|w\right| \leq 4.8 \cdot 10^{-135}:\\
\;\;\;\;\frac{\frac{6}{r}}{3 \cdot r} - 1.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(-0.75, r \cdot r, 1\right) \cdot \frac{2}{r}}{r}\\
\end{array}
if w < 4.7999999999999997e-135Initial program 84.8%
Taylor expanded in w around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
mult-flip-revN/A
metadata-evalN/A
frac-subN/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites52.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6456.6%
Applied rewrites56.6%
lift-/.f64N/A
lift-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-/r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6456.5%
Applied rewrites56.5%
if 4.7999999999999997e-135 < w Initial program 84.8%
Taylor expanded in w around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
mult-flip-revN/A
metadata-evalN/A
frac-subN/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites52.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
associate-*r/N/A
lower-/.f64N/A
Applied rewrites69.0%
(FPCore (v w r)
:precision binary64
(if (<=
(-
(-
(+ 3.0 (/ 2.0 (* r r)))
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)
-2e+154)
(* (/ (fma 0.75 (* r r) -1.0) r) (/ -2.0 r))
(- (/ (/ 6.0 r) (* 3.0 r)) 1.5)))double code(double v, double w, double r) {
double tmp;
if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+154) {
tmp = (fma(0.75, (r * r), -1.0) / r) * (-2.0 / r);
} else {
tmp = ((6.0 / r) / (3.0 * r)) - 1.5;
}
return tmp;
}
function code(v, w, r) tmp = 0.0 if (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) <= -2e+154) tmp = Float64(Float64(fma(0.75, Float64(r * r), -1.0) / r) * Float64(-2.0 / r)); else tmp = Float64(Float64(Float64(6.0 / r) / Float64(3.0 * r)) - 1.5); end return tmp end
code[v_, w_, r_] := If[LessEqual[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], -2e+154], N[(N[(N[(0.75 * N[(r * r), $MachinePrecision] + -1.0), $MachinePrecision] / r), $MachinePrecision] * N[(-2.0 / r), $MachinePrecision]), $MachinePrecision], N[(N[(N[(6.0 / r), $MachinePrecision] / N[(3.0 * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]]
\begin{array}{l}
\mathbf{if}\;\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 \leq -2 \cdot 10^{+154}:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.75, r \cdot r, -1\right)}{r} \cdot \frac{-2}{r}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{6}{r}}{3 \cdot r} - 1.5\\
\end{array}
if (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) < -2.0000000000000001e154Initial program 84.8%
Taylor expanded in w around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
mult-flip-revN/A
metadata-evalN/A
frac-subN/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites52.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
sub-to-mult-revN/A
lift-/.f64N/A
lift--.f64N/A
lift-/.f64N/A
associate-*r/N/A
lift-*.f64N/A
sqr-neg-revN/A
times-fracN/A
lower-*.f64N/A
Applied rewrites69.0%
if -2.0000000000000001e154 < (-.f64 (-.f64 (+.f64 #s(literal 3 binary64) (/.f64 #s(literal 2 binary64) (*.f64 r r))) (/.f64 (*.f64 (*.f64 #s(literal 1/8 binary64) (-.f64 #s(literal 3 binary64) (*.f64 #s(literal 2 binary64) v))) (*.f64 (*.f64 (*.f64 w w) r) r)) (-.f64 #s(literal 1 binary64) v))) #s(literal 9/2 binary64)) Initial program 84.8%
Taylor expanded in w around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
mult-flip-revN/A
metadata-evalN/A
frac-subN/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites52.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6456.6%
Applied rewrites56.6%
lift-/.f64N/A
lift-*.f64N/A
metadata-evalN/A
lift-*.f64N/A
associate-/r*N/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
*-commutativeN/A
lower-*.f6456.5%
Applied rewrites56.5%
(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;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
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(Float64(2.0 / 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[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision] - 1.5), $MachinePrecision]
\frac{\frac{2}{r}}{r} - 1.5
Initial program 84.8%
Taylor expanded in w around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
mult-flip-revN/A
metadata-evalN/A
frac-subN/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites52.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6456.6%
Applied rewrites56.6%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f6456.6%
Applied rewrites56.6%
(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;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
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]
\frac{2}{r \cdot r} - 1.5
Initial program 84.8%
Taylor expanded in w around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6456.6%
Applied rewrites56.6%
lift--.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-pow.f64N/A
pow2N/A
lift-*.f64N/A
mult-flip-revN/A
metadata-evalN/A
frac-subN/A
*-commutativeN/A
lower-/.f64N/A
Applied rewrites52.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
*-commutativeN/A
associate-/r*N/A
metadata-evalN/A
lift-*.f64N/A
lift-*.f64N/A
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
frac-timesN/A
lift-*.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
pow-divN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
lower--.f6456.6%
Applied rewrites56.6%
(FPCore (v w r) :precision binary64 -1.5)
double code(double v, double w, double r) {
return -1.5;
}
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(v, w, r)
use fmin_fmax_functions
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
-1.5
Initial program 84.8%
Taylor expanded in w around 0
lower--.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lower-pow.f6456.6%
Applied rewrites56.6%
Taylor expanded in r around inf
Applied rewrites13.6%
herbie shell --seed 2025204
(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))