
(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]
\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 10 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]
\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}
w_m = (fabs.f64 w)
(FPCore (v w_m r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<= w_m 3e+72)
(-
(-
(+ 3.0 t_0)
(* (* (* (* (fma -2.0 v 3.0) 0.125) w_m) (* w_m r)) (/ r (- 1.0 v))))
4.5)
(- (fma (* (* -0.25 (* r r)) w_m) w_m t_0) 1.5))))w_m = fabs(w);
double code(double v, double w_m, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if (w_m <= 3e+72) {
tmp = ((3.0 + t_0) - ((((fma(-2.0, v, 3.0) * 0.125) * w_m) * (w_m * r)) * (r / (1.0 - v)))) - 4.5;
} else {
tmp = fma(((-0.25 * (r * r)) * w_m), w_m, t_0) - 1.5;
}
return tmp;
}
w_m = abs(w) function code(v, w_m, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (w_m <= 3e+72) tmp = Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(Float64(fma(-2.0, v, 3.0) * 0.125) * w_m) * Float64(w_m * r)) * Float64(r / Float64(1.0 - v)))) - 4.5); else tmp = Float64(fma(Float64(Float64(-0.25 * Float64(r * r)) * w_m), w_m, t_0) - 1.5); end return tmp end
w_m = N[Abs[w], $MachinePrecision]
code[v_, w$95$m_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w$95$m, 3e+72], N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(N[(N[(-2.0 * v + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] * w$95$m), $MachinePrecision] * N[(w$95$m * r), $MachinePrecision]), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(N[(N[(-0.25 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w$95$m), $MachinePrecision] * w$95$m + t$95$0), $MachinePrecision] - 1.5), $MachinePrecision]]]
\begin{array}{l}
w_m = \left|w\right|
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;w\_m \leq 3 \cdot 10^{+72}:\\
\;\;\;\;\left(\left(3 + t\_0\right) - \left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125\right) \cdot w\_m\right) \cdot \left(w\_m \cdot r\right)\right) \cdot \frac{r}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r \cdot r\right)\right) \cdot w\_m, w\_m, t\_0\right) - 1.5\\
\end{array}
\end{array}
if w < 3.00000000000000003e72Initial program 86.9%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites93.8%
if 3.00000000000000003e72 < w Initial program 59.4%
Taylor expanded in v around inf
Applied rewrites73.0%
Taylor expanded in v around inf
Applied rewrites96.4%
w_m = (fabs.f64 w)
(FPCore (v w_m r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<=
(-
(-
(+ 3.0 t_0)
(/
(* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w_m w_m) r) r))
(- 1.0 v)))
4.5)
(- INFINITY))
(- (fma (* (* -0.25 (* r r)) w_m) w_m t_0) 1.5)
(- t_0 (fma (* w_m r) (fabs (* (* w_m r) -0.375)) 1.5)))))w_m = fabs(w);
double code(double v, double w_m, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w_m * w_m) * r) * r)) / (1.0 - v))) - 4.5) <= -((double) INFINITY)) {
tmp = fma(((-0.25 * (r * r)) * w_m), w_m, t_0) - 1.5;
} else {
tmp = t_0 - fma((w_m * r), fabs(((w_m * r) * -0.375)), 1.5);
}
return tmp;
}
w_m = abs(w) function code(v, w_m, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w_m * w_m) * r) * r)) / Float64(1.0 - v))) - 4.5) <= Float64(-Inf)) tmp = Float64(fma(Float64(Float64(-0.25 * Float64(r * r)) * w_m), w_m, t_0) - 1.5); else tmp = Float64(t_0 - fma(Float64(w_m * r), abs(Float64(Float64(w_m * r) * -0.375)), 1.5)); end return tmp end
w_m = N[Abs[w], $MachinePrecision]
code[v_, w$95$m_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w$95$m * w$95$m), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], (-Infinity)], N[(N[(N[(N[(-0.25 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w$95$m), $MachinePrecision] * w$95$m + t$95$0), $MachinePrecision] - 1.5), $MachinePrecision], N[(t$95$0 - N[(N[(w$95$m * r), $MachinePrecision] * N[Abs[N[(N[(w$95$m * r), $MachinePrecision] * -0.375), $MachinePrecision]], $MachinePrecision] + 1.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
w_m = \left|w\right|
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w\_m \cdot w\_m\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r \cdot r\right)\right) \cdot w\_m, w\_m, t\_0\right) - 1.5\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \mathsf{fma}\left(w\_m \cdot r, \left|\left(w\_m \cdot r\right) \cdot -0.375\right|, 1.5\right)\\
\end{array}
\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)) < -inf.0Initial program 75.9%
Taylor expanded in v around inf
Applied rewrites75.1%
Taylor expanded in v around inf
Applied rewrites95.4%
if -inf.0 < (-.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.9%
Taylor expanded in v around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.2
Applied rewrites86.2%
Applied rewrites90.6%
w_m = (fabs.f64 w)
(FPCore (v w_m r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<=
(-
(-
(+ 3.0 t_0)
(/
(* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w_m w_m) r) r))
(- 1.0 v)))
4.5)
-1e+23)
(* (* (fabs (* w_m r)) -0.375) (* w_m r))
(- t_0 1.5))))w_m = fabs(w);
double code(double v, double w_m, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w_m * w_m) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+23) {
tmp = (fabs((w_m * r)) * -0.375) * (w_m * r);
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
w_m = private
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_m, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w_m
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w_m * w_m) * r) * r)) / (1.0d0 - v))) - 4.5d0) <= (-1d+23)) then
tmp = (abs((w_m * r)) * (-0.375d0)) * (w_m * r)
else
tmp = t_0 - 1.5d0
end if
code = tmp
end function
w_m = Math.abs(w);
public static double code(double v, double w_m, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w_m * w_m) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+23) {
tmp = (Math.abs((w_m * r)) * -0.375) * (w_m * r);
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
w_m = math.fabs(w) def code(v, w_m, r): t_0 = 2.0 / (r * r) tmp = 0 if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w_m * w_m) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+23: tmp = (math.fabs((w_m * r)) * -0.375) * (w_m * r) else: tmp = t_0 - 1.5 return tmp
w_m = abs(w) function code(v, w_m, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w_m * w_m) * r) * r)) / Float64(1.0 - v))) - 4.5) <= -1e+23) tmp = Float64(Float64(abs(Float64(w_m * r)) * -0.375) * Float64(w_m * r)); else tmp = Float64(t_0 - 1.5); end return tmp end
w_m = abs(w); function tmp_2 = code(v, w_m, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w_m * w_m) * r) * r)) / (1.0 - v))) - 4.5) <= -1e+23) tmp = (abs((w_m * r)) * -0.375) * (w_m * r); else tmp = t_0 - 1.5; end tmp_2 = tmp; end
w_m = N[Abs[w], $MachinePrecision]
code[v_, w$95$m_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w$95$m * w$95$m), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -1e+23], N[(N[(N[Abs[N[(w$95$m * r), $MachinePrecision]], $MachinePrecision] * -0.375), $MachinePrecision] * N[(w$95$m * r), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
\begin{array}{l}
w_m = \left|w\right|
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w\_m \cdot w\_m\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -1 \cdot 10^{+23}:\\
\;\;\;\;\left(\left|w\_m \cdot r\right| \cdot -0.375\right) \cdot \left(w\_m \cdot r\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 - 1.5\\
\end{array}
\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)) < -9.9999999999999992e22Initial program 80.3%
Taylor expanded in v around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.0
Applied rewrites77.0%
Applied rewrites46.2%
Taylor expanded in w around inf
Applied rewrites40.1%
if -9.9999999999999992e22 < (-.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 83.3%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f6495.4
Applied rewrites95.4%
w_m = (fabs.f64 w)
(FPCore (v w_m r)
:precision binary64
(let* ((t_0 (/ 2.0 (* r r))))
(if (<=
(-
(-
(+ 3.0 t_0)
(/
(* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w_m w_m) r) r))
(- 1.0 v)))
4.5)
-2e+53)
(* (* (* (* -0.375 r) r) w_m) w_m)
(- t_0 1.5))))w_m = fabs(w);
double code(double v, double w_m, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w_m * w_m) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+53) {
tmp = (((-0.375 * r) * r) * w_m) * w_m;
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
w_m = private
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_m, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w_m
real(8), intent (in) :: r
real(8) :: t_0
real(8) :: tmp
t_0 = 2.0d0 / (r * r)
if ((((3.0d0 + t_0) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w_m * w_m) * r) * r)) / (1.0d0 - v))) - 4.5d0) <= (-2d+53)) then
tmp = ((((-0.375d0) * r) * r) * w_m) * w_m
else
tmp = t_0 - 1.5d0
end if
code = tmp
end function
w_m = Math.abs(w);
public static double code(double v, double w_m, double r) {
double t_0 = 2.0 / (r * r);
double tmp;
if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w_m * w_m) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+53) {
tmp = (((-0.375 * r) * r) * w_m) * w_m;
} else {
tmp = t_0 - 1.5;
}
return tmp;
}
w_m = math.fabs(w) def code(v, w_m, r): t_0 = 2.0 / (r * r) tmp = 0 if (((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w_m * w_m) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+53: tmp = (((-0.375 * r) * r) * w_m) * w_m else: tmp = t_0 - 1.5 return tmp
w_m = abs(w) function code(v, w_m, r) t_0 = Float64(2.0 / Float64(r * r)) tmp = 0.0 if (Float64(Float64(Float64(3.0 + t_0) - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(Float64(w_m * w_m) * r) * r)) / Float64(1.0 - v))) - 4.5) <= -2e+53) tmp = Float64(Float64(Float64(Float64(-0.375 * r) * r) * w_m) * w_m); else tmp = Float64(t_0 - 1.5); end return tmp end
w_m = abs(w); function tmp_2 = code(v, w_m, r) t_0 = 2.0 / (r * r); tmp = 0.0; if ((((3.0 + t_0) - (((0.125 * (3.0 - (2.0 * v))) * (((w_m * w_m) * r) * r)) / (1.0 - v))) - 4.5) <= -2e+53) tmp = (((-0.375 * r) * r) * w_m) * w_m; else tmp = t_0 - 1.5; end tmp_2 = tmp; end
w_m = N[Abs[w], $MachinePrecision]
code[v_, w$95$m_, r_] := Block[{t$95$0 = N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(3.0 + t$95$0), $MachinePrecision] - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(w$95$m * w$95$m), $MachinePrecision] * r), $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], -2e+53], N[(N[(N[(N[(-0.375 * r), $MachinePrecision] * r), $MachinePrecision] * w$95$m), $MachinePrecision] * w$95$m), $MachinePrecision], N[(t$95$0 - 1.5), $MachinePrecision]]]
\begin{array}{l}
w_m = \left|w\right|
\\
\begin{array}{l}
t_0 := \frac{2}{r \cdot r}\\
\mathbf{if}\;\left(\left(3 + t\_0\right) - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(\left(w\_m \cdot w\_m\right) \cdot r\right) \cdot r\right)}{1 - v}\right) - 4.5 \leq -2 \cdot 10^{+53}:\\
\;\;\;\;\left(\left(\left(-0.375 \cdot r\right) \cdot r\right) \cdot w\_m\right) \cdot w\_m\\
\mathbf{else}:\\
\;\;\;\;t\_0 - 1.5\\
\end{array}
\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)) < -2e53Initial program 80.1%
Taylor expanded in v around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6477.7
Applied rewrites77.7%
Applied rewrites82.0%
Taylor expanded in w around inf
Applied rewrites71.5%
if -2e53 < (-.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 83.4%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f6494.8
Applied rewrites94.8%
w_m = (fabs.f64 w)
(FPCore (v w_m r)
:precision binary64
(if (<= r 2.9e+29)
(- (fma (* (* -0.25 (* r r)) w_m) w_m (/ 2.0 (* r r))) 1.5)
(-
(-
3.0
(* (* (* (* (fma -2.0 v 3.0) 0.125) w_m) (* w_m r)) (/ r (- 1.0 v))))
4.5)))w_m = fabs(w);
double code(double v, double w_m, double r) {
double tmp;
if (r <= 2.9e+29) {
tmp = fma(((-0.25 * (r * r)) * w_m), w_m, (2.0 / (r * r))) - 1.5;
} else {
tmp = (3.0 - ((((fma(-2.0, v, 3.0) * 0.125) * w_m) * (w_m * r)) * (r / (1.0 - v)))) - 4.5;
}
return tmp;
}
w_m = abs(w) function code(v, w_m, r) tmp = 0.0 if (r <= 2.9e+29) tmp = Float64(fma(Float64(Float64(-0.25 * Float64(r * r)) * w_m), w_m, Float64(2.0 / Float64(r * r))) - 1.5); else tmp = Float64(Float64(3.0 - Float64(Float64(Float64(Float64(fma(-2.0, v, 3.0) * 0.125) * w_m) * Float64(w_m * r)) * Float64(r / Float64(1.0 - v)))) - 4.5); end return tmp end
w_m = N[Abs[w], $MachinePrecision] code[v_, w$95$m_, r_] := If[LessEqual[r, 2.9e+29], N[(N[(N[(N[(-0.25 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w$95$m), $MachinePrecision] * w$95$m + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision], N[(N[(3.0 - N[(N[(N[(N[(N[(-2.0 * v + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] * w$95$m), $MachinePrecision] * N[(w$95$m * r), $MachinePrecision]), $MachinePrecision] * N[(r / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]]
\begin{array}{l}
w_m = \left|w\right|
\\
\begin{array}{l}
\mathbf{if}\;r \leq 2.9 \cdot 10^{+29}:\\
\;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r \cdot r\right)\right) \cdot w\_m, w\_m, \frac{2}{r \cdot r}\right) - 1.5\\
\mathbf{else}:\\
\;\;\;\;\left(3 - \left(\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125\right) \cdot w\_m\right) \cdot \left(w\_m \cdot r\right)\right) \cdot \frac{r}{1 - v}\right) - 4.5\\
\end{array}
\end{array}
if r < 2.8999999999999999e29Initial program 80.7%
Taylor expanded in v around inf
Applied rewrites85.0%
Taylor expanded in v around inf
Applied rewrites92.3%
if 2.8999999999999999e29 < r Initial program 87.6%
lift-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-*.f64N/A
Applied rewrites98.1%
Taylor expanded in r around inf
Applied rewrites98.1%
w_m = (fabs.f64 w) (FPCore (v w_m r) :precision binary64 (if (<= r 3.3e+152) (- (fma (* (* -0.25 (* r r)) w_m) w_m (/ 2.0 (* r r))) 1.5) (* (fma (* (fabs (* w_m r)) -0.375) w_m (/ -1.5 r)) r)))
w_m = fabs(w);
double code(double v, double w_m, double r) {
double tmp;
if (r <= 3.3e+152) {
tmp = fma(((-0.25 * (r * r)) * w_m), w_m, (2.0 / (r * r))) - 1.5;
} else {
tmp = fma((fabs((w_m * r)) * -0.375), w_m, (-1.5 / r)) * r;
}
return tmp;
}
w_m = abs(w) function code(v, w_m, r) tmp = 0.0 if (r <= 3.3e+152) tmp = Float64(fma(Float64(Float64(-0.25 * Float64(r * r)) * w_m), w_m, Float64(2.0 / Float64(r * r))) - 1.5); else tmp = Float64(fma(Float64(abs(Float64(w_m * r)) * -0.375), w_m, Float64(-1.5 / r)) * r); end return tmp end
w_m = N[Abs[w], $MachinePrecision] code[v_, w$95$m_, r_] := If[LessEqual[r, 3.3e+152], N[(N[(N[(N[(-0.25 * N[(r * r), $MachinePrecision]), $MachinePrecision] * w$95$m), $MachinePrecision] * w$95$m + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision], N[(N[(N[(N[Abs[N[(w$95$m * r), $MachinePrecision]], $MachinePrecision] * -0.375), $MachinePrecision] * w$95$m + N[(-1.5 / r), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]]
\begin{array}{l}
w_m = \left|w\right|
\\
\begin{array}{l}
\mathbf{if}\;r \leq 3.3 \cdot 10^{+152}:\\
\;\;\;\;\mathsf{fma}\left(\left(-0.25 \cdot \left(r \cdot r\right)\right) \cdot w\_m, w\_m, \frac{2}{r \cdot r}\right) - 1.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left|w\_m \cdot r\right| \cdot -0.375, w\_m, \frac{-1.5}{r}\right) \cdot r\\
\end{array}
\end{array}
if r < 3.3000000000000001e152Initial program 81.8%
Taylor expanded in v around inf
Applied rewrites84.6%
Taylor expanded in v around inf
Applied rewrites91.7%
if 3.3000000000000001e152 < r Initial program 84.4%
Taylor expanded in v around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6461.5
Applied rewrites61.5%
Applied rewrites51.4%
Taylor expanded in r around inf
Applied rewrites51.3%
w_m = (fabs.f64 w) (FPCore (v w_m r) :precision binary64 (if (<= r 6700.0) (- (/ 2.0 (* r r)) 1.5) (* (fma (* (fabs (* w_m r)) -0.375) w_m (/ -1.5 r)) r)))
w_m = fabs(w);
double code(double v, double w_m, double r) {
double tmp;
if (r <= 6700.0) {
tmp = (2.0 / (r * r)) - 1.5;
} else {
tmp = fma((fabs((w_m * r)) * -0.375), w_m, (-1.5 / r)) * r;
}
return tmp;
}
w_m = abs(w) function code(v, w_m, r) tmp = 0.0 if (r <= 6700.0) tmp = Float64(Float64(2.0 / Float64(r * r)) - 1.5); else tmp = Float64(fma(Float64(abs(Float64(w_m * r)) * -0.375), w_m, Float64(-1.5 / r)) * r); end return tmp end
w_m = N[Abs[w], $MachinePrecision] code[v_, w$95$m_, r_] := If[LessEqual[r, 6700.0], N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision], N[(N[(N[(N[Abs[N[(w$95$m * r), $MachinePrecision]], $MachinePrecision] * -0.375), $MachinePrecision] * w$95$m + N[(-1.5 / r), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision]]
\begin{array}{l}
w_m = \left|w\right|
\\
\begin{array}{l}
\mathbf{if}\;r \leq 6700:\\
\;\;\;\;\frac{2}{r \cdot r} - 1.5\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left|w\_m \cdot r\right| \cdot -0.375, w\_m, \frac{-1.5}{r}\right) \cdot r\\
\end{array}
\end{array}
if r < 6700Initial program 80.8%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f6471.3
Applied rewrites71.3%
if 6700 < r Initial program 86.7%
Taylor expanded in v around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6472.5
Applied rewrites72.5%
Applied rewrites52.1%
Taylor expanded in r around inf
Applied rewrites52.0%
w_m = (fabs.f64 w) (FPCore (v w_m r) :precision binary64 (if (<= r 1.15) (/ 2.0 (* r r)) -1.5))
w_m = fabs(w);
double code(double v, double w_m, double r) {
double tmp;
if (r <= 1.15) {
tmp = 2.0 / (r * r);
} else {
tmp = -1.5;
}
return tmp;
}
w_m = private
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_m, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w_m
real(8), intent (in) :: r
real(8) :: tmp
if (r <= 1.15d0) then
tmp = 2.0d0 / (r * r)
else
tmp = -1.5d0
end if
code = tmp
end function
w_m = Math.abs(w);
public static double code(double v, double w_m, double r) {
double tmp;
if (r <= 1.15) {
tmp = 2.0 / (r * r);
} else {
tmp = -1.5;
}
return tmp;
}
w_m = math.fabs(w) def code(v, w_m, r): tmp = 0 if r <= 1.15: tmp = 2.0 / (r * r) else: tmp = -1.5 return tmp
w_m = abs(w) function code(v, w_m, r) tmp = 0.0 if (r <= 1.15) tmp = Float64(2.0 / Float64(r * r)); else tmp = -1.5; end return tmp end
w_m = abs(w); function tmp_2 = code(v, w_m, r) tmp = 0.0; if (r <= 1.15) tmp = 2.0 / (r * r); else tmp = -1.5; end tmp_2 = tmp; end
w_m = N[Abs[w], $MachinePrecision] code[v_, w$95$m_, r_] := If[LessEqual[r, 1.15], N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision], -1.5]
\begin{array}{l}
w_m = \left|w\right|
\\
\begin{array}{l}
\mathbf{if}\;r \leq 1.15:\\
\;\;\;\;\frac{2}{r \cdot r}\\
\mathbf{else}:\\
\;\;\;\;-1.5\\
\end{array}
\end{array}
if r < 1.1499999999999999Initial program 80.8%
Taylor expanded in r around 0
lower-/.f64N/A
unpow2N/A
lower-*.f6467.5
Applied rewrites67.5%
if 1.1499999999999999 < r Initial program 86.7%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f6433.1
Applied rewrites33.1%
Taylor expanded in r around inf
Applied rewrites33.1%
w_m = (fabs.f64 w) (FPCore (v w_m r) :precision binary64 (- (/ 2.0 (* r r)) 1.5))
w_m = fabs(w);
double code(double v, double w_m, double r) {
return (2.0 / (r * r)) - 1.5;
}
w_m = private
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_m, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w_m
real(8), intent (in) :: r
code = (2.0d0 / (r * r)) - 1.5d0
end function
w_m = Math.abs(w);
public static double code(double v, double w_m, double r) {
return (2.0 / (r * r)) - 1.5;
}
w_m = math.fabs(w) def code(v, w_m, r): return (2.0 / (r * r)) - 1.5
w_m = abs(w) function code(v, w_m, r) return Float64(Float64(2.0 / Float64(r * r)) - 1.5) end
w_m = abs(w); function tmp = code(v, w_m, r) tmp = (2.0 / (r * r)) - 1.5; end
w_m = N[Abs[w], $MachinePrecision] code[v_, w$95$m_, r_] := N[(N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision] - 1.5), $MachinePrecision]
\begin{array}{l}
w_m = \left|w\right|
\\
\frac{2}{r \cdot r} - 1.5
\end{array}
Initial program 82.1%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f6462.8
Applied rewrites62.8%
w_m = (fabs.f64 w) (FPCore (v w_m r) :precision binary64 -1.5)
w_m = fabs(w);
double code(double v, double w_m, double r) {
return -1.5;
}
w_m = private
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_m, r)
use fmin_fmax_functions
real(8), intent (in) :: v
real(8), intent (in) :: w_m
real(8), intent (in) :: r
code = -1.5d0
end function
w_m = Math.abs(w);
public static double code(double v, double w_m, double r) {
return -1.5;
}
w_m = math.fabs(w) def code(v, w_m, r): return -1.5
w_m = abs(w) function code(v, w_m, r) return -1.5 end
w_m = abs(w); function tmp = code(v, w_m, r) tmp = -1.5; end
w_m = N[Abs[w], $MachinePrecision] code[v_, w$95$m_, r_] := -1.5
\begin{array}{l}
w_m = \left|w\right|
\\
-1.5
\end{array}
Initial program 82.1%
Taylor expanded in w around 0
lower--.f64N/A
associate-*r/N/A
metadata-evalN/A
lower-/.f64N/A
unpow2N/A
lower-*.f6462.8
Applied rewrites62.8%
Taylor expanded in r around inf
Applied rewrites10.7%
herbie shell --seed 2024359
(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))