
(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}
Herbie found 13 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}
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r))))
(t_1 (- (- t_0 (* 0.25 (* (* w r) (* w r)))) 4.5)))
(if (<= v -2e+71)
t_1
(if (<= v 2.5e+14)
(-
(-
t_0
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* r w) (* r w))) (- 1.0 v)))
4.5)
t_1))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double t_1 = (t_0 - (0.25 * ((w * r) * (w * r)))) - 4.5;
double tmp;
if (v <= -2e+71) {
tmp = t_1;
} else if (v <= 2.5e+14) {
tmp = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5;
} else {
tmp = t_1;
}
return tmp;
}
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
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 3.0d0 + (2.0d0 / (r * r))
t_1 = (t_0 - (0.25d0 * ((w * r) * (w * r)))) - 4.5d0
if (v <= (-2d+71)) then
tmp = t_1
else if (v <= 2.5d+14) then
tmp = (t_0 - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * ((r * w) * (r * w))) / (1.0d0 - v))) - 4.5d0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double t_1 = (t_0 - (0.25 * ((w * r) * (w * r)))) - 4.5;
double tmp;
if (v <= -2e+71) {
tmp = t_1;
} else if (v <= 2.5e+14) {
tmp = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5;
} else {
tmp = t_1;
}
return tmp;
}
def code(v, w, r): t_0 = 3.0 + (2.0 / (r * r)) t_1 = (t_0 - (0.25 * ((w * r) * (w * r)))) - 4.5 tmp = 0 if v <= -2e+71: tmp = t_1 elif v <= 2.5e+14: tmp = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5 else: tmp = t_1 return tmp
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) t_1 = Float64(Float64(t_0 - Float64(0.25 * Float64(Float64(w * r) * Float64(w * r)))) - 4.5) tmp = 0.0 if (v <= -2e+71) tmp = t_1; elseif (v <= 2.5e+14) tmp = Float64(Float64(t_0 - Float64(Float64(Float64(0.125 * Float64(3.0 - Float64(2.0 * v))) * Float64(Float64(r * w) * Float64(r * w))) / Float64(1.0 - v))) - 4.5); else tmp = t_1; end return tmp end
function tmp_2 = code(v, w, r) t_0 = 3.0 + (2.0 / (r * r)); t_1 = (t_0 - (0.25 * ((w * r) * (w * r)))) - 4.5; tmp = 0.0; if (v <= -2e+71) tmp = t_1; elseif (v <= 2.5e+14) tmp = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5; else tmp = t_1; end tmp_2 = tmp; end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 - N[(0.25 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[v, -2e+71], t$95$1, If[LessEqual[v, 2.5e+14], N[(N[(t$95$0 - N[(N[(N[(0.125 * N[(3.0 - N[(2.0 * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
t_1 := \left(t\_0 - 0.25 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)\right) - 4.5\\
\mathbf{if}\;v \leq -2 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;v \leq 2.5 \cdot 10^{+14}:\\
\;\;\;\;\left(t\_0 - \frac{\left(0.125 \cdot \left(3 - 2 \cdot v\right)\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if v < -2.0000000000000001e71 or 2.5e14 < v Initial program 80.5%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6488.8
Applied rewrites88.8%
Taylor expanded in v around inf
Applied rewrites99.8%
lift-*.f64N/A
*-commutativeN/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6499.8
Applied rewrites99.8%
if -2.0000000000000001e71 < v < 2.5e14Initial program 88.3%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6499.5
Applied rewrites99.5%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (pow (* w r) 2.0)))
(if (<= r 3.6e-12)
(- (* (pow r -2.0) 2.0) (fma t_0 0.375 1.5))
(- 3.0 (fma (* (fma v -2.0 3.0) 0.125) (/ t_0 (- 1.0 v)) 4.5)))))
double code(double v, double w, double r) {
double t_0 = pow((w * r), 2.0);
double tmp;
if (r <= 3.6e-12) {
tmp = (pow(r, -2.0) * 2.0) - fma(t_0, 0.375, 1.5);
} else {
tmp = 3.0 - fma((fma(v, -2.0, 3.0) * 0.125), (t_0 / (1.0 - v)), 4.5);
}
return tmp;
}
function code(v, w, r) t_0 = Float64(w * r) ^ 2.0 tmp = 0.0 if (r <= 3.6e-12) tmp = Float64(Float64((r ^ -2.0) * 2.0) - fma(t_0, 0.375, 1.5)); else tmp = Float64(3.0 - fma(Float64(fma(v, -2.0, 3.0) * 0.125), Float64(t_0 / Float64(1.0 - v)), 4.5)); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[Power[N[(w * r), $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[r, 3.6e-12], N[(N[(N[Power[r, -2.0], $MachinePrecision] * 2.0), $MachinePrecision] - N[(t$95$0 * 0.375 + 1.5), $MachinePrecision]), $MachinePrecision], N[(3.0 - N[(N[(N[(v * -2.0 + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] * N[(t$95$0 / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(w \cdot r\right)}^{2}\\
\mathbf{if}\;r \leq 3.6 \cdot 10^{-12}:\\
\;\;\;\;{r}^{-2} \cdot 2 - \mathsf{fma}\left(t\_0, 0.375, 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;3 - \mathsf{fma}\left(\mathsf{fma}\left(v, -2, 3\right) \cdot 0.125, \frac{t\_0}{1 - v}, 4.5\right)\\
\end{array}
\end{array}
if r < 3.6e-12Initial program 83.3%
Taylor expanded in v around 0
lower--.f64N/A
*-commutativeN/A
lower-*.f64N/A
pow-flipN/A
metadata-evalN/A
lower-pow.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
pow-prod-downN/A
lower-pow.f64N/A
lower-*.f6494.8
Applied rewrites94.8%
if 3.6e-12 < r Initial program 89.4%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6493.6
Applied rewrites93.6%
Taylor expanded in r around inf
metadata-eval91.5
pow291.5
associate-*r/91.5
+-commutative91.5
pow-flip91.5
metadata-eval91.5
lift-pow.f64N/A
*-commutativeN/A
lift-pow.f6491.5
Applied rewrites91.5%
Applied rewrites97.7%
(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)
-1.0)
(- 3.0 (fma (* (fma v -2.0 3.0) 0.125) (/ (pow (* w r) 2.0) (- 1.0 v)) 4.5))
(* (pow r -2.0) 2.0)))
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) <= -1.0) {
tmp = 3.0 - fma((fma(v, -2.0, 3.0) * 0.125), (pow((w * r), 2.0) / (1.0 - v)), 4.5);
} else {
tmp = pow(r, -2.0) * 2.0;
}
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) <= -1.0) tmp = Float64(3.0 - fma(Float64(fma(v, -2.0, 3.0) * 0.125), Float64((Float64(w * r) ^ 2.0) / Float64(1.0 - v)), 4.5)); else tmp = Float64((r ^ -2.0) * 2.0); 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], -1.0], N[(3.0 - N[(N[(N[(v * -2.0 + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] * N[(N[Power[N[(w * r), $MachinePrecision], 2.0], $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision] + 4.5), $MachinePrecision]), $MachinePrecision], N[(N[Power[r, -2.0], $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\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 -1:\\
\;\;\;\;3 - \mathsf{fma}\left(\mathsf{fma}\left(v, -2, 3\right) \cdot 0.125, \frac{{\left(w \cdot r\right)}^{2}}{1 - v}, 4.5\right)\\
\mathbf{else}:\\
\;\;\;\;{r}^{-2} \cdot 2\\
\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)) < -1Initial program 84.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6492.2
Applied rewrites92.2%
Taylor expanded in r around inf
metadata-eval89.7
pow289.7
associate-*r/89.7
+-commutative89.7
pow-flip89.7
metadata-eval89.7
lift-pow.f64N/A
*-commutativeN/A
lift-pow.f6489.7
Applied rewrites89.7%
Applied rewrites96.3%
if -1 < (-.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 85.2%
Taylor expanded in r around 0
metadata-evalN/A
associate-*r/N/A
*-commutativeN/A
lower-*.f64N/A
pow-flipN/A
metadata-evalN/A
lower-pow.f6499.2
Applied rewrites99.2%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r))))
(t_1
(-
(-
t_0
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)))
(if (<= t_1 (- INFINITY))
(- (- t_0 (* 0.25 (* (* w r) (* w r)))) 4.5)
(if (<= t_1 -1.0)
(-
(-
3.0
(/ (* (* (* (* (fma v -2.0 3.0) 0.125) w) r) (* w r)) (- 1.0 v)))
4.5)
(/ (/ 2.0 r) r)))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double t_1 = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t_0 - (0.25 * ((w * r) * (w * r)))) - 4.5;
} else if (t_1 <= -1.0) {
tmp = (3.0 - (((((fma(v, -2.0, 3.0) * 0.125) * w) * r) * (w * r)) / (1.0 - v))) - 4.5;
} else {
tmp = (2.0 / r) / r;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) t_1 = Float64(Float64(t_0 - 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) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t_0 - Float64(0.25 * Float64(Float64(w * r) * Float64(w * r)))) - 4.5); elseif (t_1 <= -1.0) tmp = Float64(Float64(3.0 - Float64(Float64(Float64(Float64(Float64(fma(v, -2.0, 3.0) * 0.125) * w) * r) * Float64(w * r)) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(2.0 / r) / r); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 - 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t$95$0 - N[(0.25 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$1, -1.0], N[(N[(3.0 - N[(N[(N[(N[(N[(N[(v * -2.0 + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] * w), $MachinePrecision] * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
t_1 := \left(t\_0 - \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\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(t\_0 - 0.25 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)\right) - 4.5\\
\mathbf{elif}\;t\_1 \leq -1:\\
\;\;\;\;\left(3 - \frac{\left(\left(\left(\mathsf{fma}\left(v, -2, 3\right) \cdot 0.125\right) \cdot w\right) \cdot r\right) \cdot \left(w \cdot r\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{r}}{r}\\
\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 82.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6488.6
Applied rewrites88.6%
Taylor expanded in v around inf
Applied rewrites97.9%
lift-*.f64N/A
*-commutativeN/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6497.9
Applied rewrites97.9%
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)) < -1Initial program 87.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6497.5
Applied rewrites97.5%
Taylor expanded in r around inf
metadata-eval96.4
pow296.4
associate-*r/96.4
+-commutative96.4
pow-flip96.4
metadata-eval96.4
lift-pow.f64N/A
*-commutativeN/A
lift-pow.f6496.4
Applied rewrites96.4%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
fp-cancel-sub-sign-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6496.4
Applied rewrites96.4%
lift-*.f64N/A
lift-*.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
lift-fma.f64N/A
lift-*.f6496.5
Applied rewrites96.5%
if -1 < (-.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 85.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.6
Applied rewrites99.6%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in r around 0
Applied rewrites99.1%
Applied rewrites99.1%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r))))
(t_1
(-
(-
t_0
(/ (* (* 0.125 (- 3.0 (* 2.0 v))) (* (* (* w w) r) r)) (- 1.0 v)))
4.5)))
(if (<= t_1 (- INFINITY))
(- (- t_0 (* 0.25 (* (* w r) (* w r)))) 4.5)
(if (<= t_1 -1.0)
(-
(- 3.0 (/ (* (fma -0.25 v 0.375) (* (* r w) (* r w))) (- 1.0 v)))
4.5)
(/ (/ 2.0 r) r)))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double t_1 = (t_0 - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (t_0 - (0.25 * ((w * r) * (w * r)))) - 4.5;
} else if (t_1 <= -1.0) {
tmp = (3.0 - ((fma(-0.25, v, 0.375) * ((r * w) * (r * w))) / (1.0 - v))) - 4.5;
} else {
tmp = (2.0 / r) / r;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) t_1 = Float64(Float64(t_0 - 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) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(t_0 - Float64(0.25 * Float64(Float64(w * r) * Float64(w * r)))) - 4.5); elseif (t_1 <= -1.0) tmp = Float64(Float64(3.0 - Float64(Float64(fma(-0.25, v, 0.375) * Float64(Float64(r * w) * Float64(r * w))) / Float64(1.0 - v))) - 4.5); else tmp = Float64(Float64(2.0 / r) / r); end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 - 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(t$95$0 - N[(0.25 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], If[LessEqual[t$95$1, -1.0], N[(N[(3.0 - N[(N[(N[(-0.25 * v + 0.375), $MachinePrecision] * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
t_1 := \left(t\_0 - \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\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\left(t\_0 - 0.25 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)\right) - 4.5\\
\mathbf{elif}\;t\_1 \leq -1:\\
\;\;\;\;\left(3 - \frac{\mathsf{fma}\left(-0.25, v, 0.375\right) \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{r}}{r}\\
\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 82.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6488.6
Applied rewrites88.6%
Taylor expanded in v around inf
Applied rewrites97.9%
lift-*.f64N/A
*-commutativeN/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6497.9
Applied rewrites97.9%
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)) < -1Initial program 87.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6497.5
Applied rewrites97.5%
Taylor expanded in r around inf
metadata-eval96.4
pow296.4
associate-*r/96.4
+-commutative96.4
pow-flip96.4
metadata-eval96.4
lift-pow.f64N/A
*-commutativeN/A
lift-pow.f6496.4
Applied rewrites96.4%
Taylor expanded in v around 0
+-commutativeN/A
lower-fma.f6496.4
Applied rewrites96.4%
if -1 < (-.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 85.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.6
Applied rewrites99.6%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in r around 0
Applied rewrites99.1%
Applied rewrites99.1%
(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)
-1.0)
(- (- 3.0 (/ (* 0.375 (* (* r w) (* r w))) 1.0)) 4.5)
(/ (/ 2.0 r) r)))
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) <= -1.0) {
tmp = (3.0 - ((0.375 * ((r * w) * (r * w))) / 1.0)) - 4.5;
} else {
tmp = (2.0 / r) / r;
}
return tmp;
}
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
real(8) :: tmp
if ((((3.0d0 + (2.0d0 / (r * r))) - (((0.125d0 * (3.0d0 - (2.0d0 * v))) * (((w * w) * r) * r)) / (1.0d0 - v))) - 4.5d0) <= (-1.0d0)) then
tmp = (3.0d0 - ((0.375d0 * ((r * w) * (r * w))) / 1.0d0)) - 4.5d0
else
tmp = (2.0d0 / r) / r
end if
code = tmp
end function
public static 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) <= -1.0) {
tmp = (3.0 - ((0.375 * ((r * w) * (r * w))) / 1.0)) - 4.5;
} else {
tmp = (2.0 / r) / r;
}
return tmp;
}
def code(v, w, r): tmp = 0 if (((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1.0: tmp = (3.0 - ((0.375 * ((r * w) * (r * w))) / 1.0)) - 4.5 else: tmp = (2.0 / r) / r 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) <= -1.0) tmp = Float64(Float64(3.0 - Float64(Float64(0.375 * Float64(Float64(r * w) * Float64(r * w))) / 1.0)) - 4.5); else tmp = Float64(Float64(2.0 / r) / r); end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if ((((3.0 + (2.0 / (r * r))) - (((0.125 * (3.0 - (2.0 * v))) * (((w * w) * r) * r)) / (1.0 - v))) - 4.5) <= -1.0) tmp = (3.0 - ((0.375 * ((r * w) * (r * w))) / 1.0)) - 4.5; else tmp = (2.0 / r) / r; end tmp_2 = 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], -1.0], N[(N[(3.0 - N[(N[(0.375 * N[(N[(r * w), $MachinePrecision] * N[(r * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 1.0), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision]]
\begin{array}{l}
\\
\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 -1:\\
\;\;\;\;\left(3 - \frac{0.375 \cdot \left(\left(r \cdot w\right) \cdot \left(r \cdot w\right)\right)}{1}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{r}}{r}\\
\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)) < -1Initial program 84.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6492.2
Applied rewrites92.2%
Taylor expanded in r around inf
metadata-eval89.7
pow289.7
associate-*r/89.7
+-commutative89.7
pow-flip89.7
metadata-eval89.7
lift-pow.f64N/A
*-commutativeN/A
lift-pow.f6489.7
Applied rewrites89.7%
Taylor expanded in v around 0
Applied rewrites71.7%
Taylor expanded in v around 0
Applied rewrites85.5%
if -1 < (-.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 85.2%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6499.6
Applied rewrites99.6%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6499.6
Applied rewrites99.6%
Taylor expanded in r around 0
Applied rewrites99.1%
Applied rewrites99.1%
(FPCore (v w r)
:precision binary64
(let* ((t_0 (+ 3.0 (/ 2.0 (* r r))))
(t_1 (- (- t_0 (* 0.25 (* (* w r) (* w r)))) 4.5)))
(if (<= v -1e+70)
t_1
(if (<= v 2e+39)
(-
(-
t_0
(/ (* (* (* (fma -2.0 v 3.0) 0.125) (* w (* w r))) r) (- 1.0 v)))
4.5)
t_1))))
double code(double v, double w, double r) {
double t_0 = 3.0 + (2.0 / (r * r));
double t_1 = (t_0 - (0.25 * ((w * r) * (w * r)))) - 4.5;
double tmp;
if (v <= -1e+70) {
tmp = t_1;
} else if (v <= 2e+39) {
tmp = (t_0 - ((((fma(-2.0, v, 3.0) * 0.125) * (w * (w * r))) * r) / (1.0 - v))) - 4.5;
} else {
tmp = t_1;
}
return tmp;
}
function code(v, w, r) t_0 = Float64(3.0 + Float64(2.0 / Float64(r * r))) t_1 = Float64(Float64(t_0 - Float64(0.25 * Float64(Float64(w * r) * Float64(w * r)))) - 4.5) tmp = 0.0 if (v <= -1e+70) tmp = t_1; elseif (v <= 2e+39) tmp = Float64(Float64(t_0 - Float64(Float64(Float64(Float64(fma(-2.0, v, 3.0) * 0.125) * Float64(w * Float64(w * r))) * r) / Float64(1.0 - v))) - 4.5); else tmp = t_1; end return tmp end
code[v_, w_, r_] := Block[{t$95$0 = N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 - N[(0.25 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]}, If[LessEqual[v, -1e+70], t$95$1, If[LessEqual[v, 2e+39], N[(N[(t$95$0 - N[(N[(N[(N[(N[(-2.0 * v + 3.0), $MachinePrecision] * 0.125), $MachinePrecision] * N[(w * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * r), $MachinePrecision] / N[(1.0 - v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 3 + \frac{2}{r \cdot r}\\
t_1 := \left(t\_0 - 0.25 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)\right) - 4.5\\
\mathbf{if}\;v \leq -1 \cdot 10^{+70}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;v \leq 2 \cdot 10^{+39}:\\
\;\;\;\;\left(t\_0 - \frac{\left(\left(\mathsf{fma}\left(-2, v, 3\right) \cdot 0.125\right) \cdot \left(w \cdot \left(w \cdot r\right)\right)\right) \cdot r}{1 - v}\right) - 4.5\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if v < -1.00000000000000007e70 or 1.99999999999999988e39 < v Initial program 80.2%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6488.3
Applied rewrites88.3%
Taylor expanded in v around inf
Applied rewrites99.8%
lift-*.f64N/A
*-commutativeN/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6499.8
Applied rewrites99.8%
if -1.00000000000000007e70 < v < 1.99999999999999988e39Initial program 88.3%
lift-*.f64N/A
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
+-commutativeN/A
lower-fma.f6488.3
Applied rewrites88.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6496.5
Applied rewrites96.5%
(FPCore (v w r) :precision binary64 (- (- (+ 3.0 (/ 2.0 (* r r))) (* 0.25 (* (* w r) (* w r)))) 4.5))
double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (0.25 * ((w * r) * (w * r)))) - 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.25d0 * ((w * r) * (w * r)))) - 4.5d0
end function
public static double code(double v, double w, double r) {
return ((3.0 + (2.0 / (r * r))) - (0.25 * ((w * r) * (w * r)))) - 4.5;
}
def code(v, w, r): return ((3.0 + (2.0 / (r * r))) - (0.25 * ((w * r) * (w * r)))) - 4.5
function code(v, w, r) return Float64(Float64(Float64(3.0 + Float64(2.0 / Float64(r * r))) - Float64(0.25 * Float64(Float64(w * r) * Float64(w * r)))) - 4.5) end
function tmp = code(v, w, r) tmp = ((3.0 + (2.0 / (r * r))) - (0.25 * ((w * r) * (w * r)))) - 4.5; end
code[v_, w_, r_] := N[(N[(N[(3.0 + N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.25 * N[(N[(w * r), $MachinePrecision] * N[(w * r), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 4.5), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(3 + \frac{2}{r \cdot r}\right) - 0.25 \cdot \left(\left(w \cdot r\right) \cdot \left(w \cdot r\right)\right)\right) - 4.5
\end{array}
Initial program 84.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.8
Applied rewrites94.8%
Taylor expanded in v around inf
Applied rewrites93.2%
lift-*.f64N/A
*-commutativeN/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6493.2
Applied rewrites93.2%
(FPCore (v w r) :precision binary64 (/ (/ (fma (* -1.5 r) r 2.0) r) r))
double code(double v, double w, double r) {
return (fma((-1.5 * r), r, 2.0) / r) / r;
}
function code(v, w, r) return Float64(Float64(fma(Float64(-1.5 * r), r, 2.0) / r) / r) end
code[v_, w_, r_] := N[(N[(N[(N[(-1.5 * r), $MachinePrecision] * r + 2.0), $MachinePrecision] / r), $MachinePrecision] / r), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\mathsf{fma}\left(-1.5 \cdot r, r, 2\right)}{r}}{r}
\end{array}
Initial program 84.9%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
associate-*l*N/A
pow2N/A
*-commutativeN/A
pow-prod-downN/A
unpow2N/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6494.8
Applied rewrites94.8%
Taylor expanded in v around inf
Applied rewrites93.2%
lift-*.f64N/A
*-commutativeN/A
lower-pow.f64N/A
pow2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f6493.2
Applied rewrites93.2%
Taylor expanded in r around 0
Applied rewrites69.1%
(FPCore (v w r) :precision binary64 (/ (/ (fma (* r r) -1.5 2.0) r) r))
double code(double v, double w, double r) {
return (fma((r * r), -1.5, 2.0) / r) / r;
}
function code(v, w, r) return Float64(Float64(fma(Float64(r * r), -1.5, 2.0) / r) / r) end
code[v_, w_, r_] := N[(N[(N[(N[(r * r), $MachinePrecision] * -1.5 + 2.0), $MachinePrecision] / r), $MachinePrecision] / r), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{\mathsf{fma}\left(r \cdot r, -1.5, 2\right)}{r}}{r}
\end{array}
Initial program 84.9%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6453.0
Applied rewrites53.0%
lift-/.f64N/A
lift-fma.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64N/A
lift-*.f64N/A
lift-*.f64N/A
pow2N/A
*-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f6469.1
Applied rewrites69.1%
(FPCore (v w r) :precision binary64 (if (<= r 3.6e-12) (/ (/ 2.0 r) r) -1.5))
double code(double v, double w, double r) {
double tmp;
if (r <= 3.6e-12) {
tmp = (2.0 / r) / r;
} else {
tmp = -1.5;
}
return tmp;
}
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
real(8) :: tmp
if (r <= 3.6d-12) then
tmp = (2.0d0 / r) / r
else
tmp = -1.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 3.6e-12) {
tmp = (2.0 / r) / r;
} else {
tmp = -1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 3.6e-12: tmp = (2.0 / r) / r else: tmp = -1.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 3.6e-12) tmp = Float64(Float64(2.0 / r) / r); else tmp = -1.5; end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 3.6e-12) tmp = (2.0 / r) / r; else tmp = -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 3.6e-12], N[(N[(2.0 / r), $MachinePrecision] / r), $MachinePrecision], -1.5]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 3.6 \cdot 10^{-12}:\\
\;\;\;\;\frac{\frac{2}{r}}{r}\\
\mathbf{else}:\\
\;\;\;\;-1.5\\
\end{array}
\end{array}
if r < 3.6e-12Initial program 83.3%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6464.7
Applied rewrites64.7%
lift-fma.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f6464.7
Applied rewrites64.7%
Taylor expanded in r around 0
Applied rewrites57.9%
Applied rewrites57.8%
if 3.6e-12 < r Initial program 89.4%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6419.8
Applied rewrites19.8%
Taylor expanded in r around inf
Applied rewrites25.4%
(FPCore (v w r) :precision binary64 (if (<= r 3.6e-12) (/ 2.0 (* r r)) -1.5))
double code(double v, double w, double r) {
double tmp;
if (r <= 3.6e-12) {
tmp = 2.0 / (r * r);
} else {
tmp = -1.5;
}
return tmp;
}
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
real(8) :: tmp
if (r <= 3.6d-12) then
tmp = 2.0d0 / (r * r)
else
tmp = -1.5d0
end if
code = tmp
end function
public static double code(double v, double w, double r) {
double tmp;
if (r <= 3.6e-12) {
tmp = 2.0 / (r * r);
} else {
tmp = -1.5;
}
return tmp;
}
def code(v, w, r): tmp = 0 if r <= 3.6e-12: tmp = 2.0 / (r * r) else: tmp = -1.5 return tmp
function code(v, w, r) tmp = 0.0 if (r <= 3.6e-12) tmp = Float64(2.0 / Float64(r * r)); else tmp = -1.5; end return tmp end
function tmp_2 = code(v, w, r) tmp = 0.0; if (r <= 3.6e-12) tmp = 2.0 / (r * r); else tmp = -1.5; end tmp_2 = tmp; end
code[v_, w_, r_] := If[LessEqual[r, 3.6e-12], N[(2.0 / N[(r * r), $MachinePrecision]), $MachinePrecision], -1.5]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;r \leq 3.6 \cdot 10^{-12}:\\
\;\;\;\;\frac{2}{r \cdot r}\\
\mathbf{else}:\\
\;\;\;\;-1.5\\
\end{array}
\end{array}
if r < 3.6e-12Initial program 83.3%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6464.7
Applied rewrites64.7%
Taylor expanded in r around 0
Applied rewrites57.9%
if 3.6e-12 < r Initial program 89.4%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6419.8
Applied rewrites19.8%
Taylor expanded in r around inf
Applied rewrites25.4%
(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
\begin{array}{l}
\\
-1.5
\end{array}
Initial program 84.9%
Taylor expanded in r around 0
lower-/.f64N/A
+-commutativeN/A
lower-fma.f64N/A
pow2N/A
lift-*.f64N/A
pow2N/A
lift-*.f6453.0
Applied rewrites53.0%
Taylor expanded in r around inf
Applied rewrites14.4%
herbie shell --seed 2025093
(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))